Please enable JavaScript.
Coggle requires JavaScript to display documents.
Kump 1, JESLIN, STEPHANIE, ANDREA - Coggle Diagram
Kump 1
Array
ARRAY REPRESENTATION
-
-
-
Each element can be accessed via its index. For example, we can fetch an element at index 6 as 9.
Array is a container which can hold a fix number of items and these items should be of the same type.
BASIC OPERATIONS
Traverse − print all the array elements one by one.
Insertion − Adds an element at the given index.
Deletion − Deletes an element at the given index.
Search − Searches an element using the given index or by the value.
Update − Updates an element at the given index.
DISADVANTAGES OF ARRAYS
The size of an array is fixed. Once the memory is allocated to an array, it cannot be increased or decreased.
This prevents us from storing extra data in case we want to. These arrays of fixed size are called static arrays.
we allocate more memory than requirement then the memory space will be wasted. And if we allocate less memory than requirement, then it will create problem
elements of array are stored in consecutive memory locations. So insertions and deletions are very difficult and time consuming.
Element − Each item stored in an array is called an element.
Index − Each location of an element in an array has a numerical index, which is used to identify the element.
-
-
-
Abstract Data Type (ADT
Abstract Data Type (ADT) is a type for objects whose behavior is defined by a set of value and a set of operations. It is called abstract because it gives an implementation-independent view. The process of providing only the essentials and hiding the details is known as abstraction.
Lists ADT : The data is generally stored in key sequence in a list which has a head structure consisting of count, pointers and address of compare function needed to compare the data in the list.
-
Stacks ADT : In Stack ADT Implementation instead of data being stored in each node, the pointer to data is stored. The program allocates memory for the data and address is passed to the stack ADT. The head node and the data nodes are encapsulated in the ADT.
Types data structure
Static And Dynamic
Static
-
-
-
Dynamic
-
Is a data structure that changes in size as a program needs it by allocating and de-allocating memory
It is refers to an organization or collection of data in memory that has the flexibility to grow or shrink in size, enabling a programmer to control exactly how much memory is utilized
Primitive And Non-primitive
Primitive
-
Primitive data structure will contain some value, it cannot be NULL.The size depends on the type of the data structure.
Integer: This is used to represent a number without decimal point.
Float and Double: This is used to represent a number with decimal point.
Character : This is used to represent single character
String: This is used to represent group of characters
Boolean: This is used represent logical values either true or false
Non-Primitive
Arrays : a collection of elements (values or variables), each identified by at least one array index or key
Structure : a specialized format for organizing and storing data
Union : a value that may have any of several representations or formats
Linked List : a linear collection of data elements, called nodes, each pointing to the next node by means of a pointer
Stacks : an ordered list of similar data type
Queues : an abstract data structure, somewhat similar to Stacks
Non-primitive data structure is a type of data structure that can store the data of more than one type.
Non-primitive data structure can consist of a NULL value.In case of non-primitive data structure, size is not fixed.
Linear And Non-linear
Linear
Data element can be attached to several other data elements to represent specific relationships that exist among them. The data items are not arranged in sequential structure
Its examples are array, stack, queue, linked list
-
Non-linear
Data elements are organized sequentially, in which only one data element can directly be reached.
-
-
Declaring Structure
A structure declaration names a type and specifies a sequence of variable values called members or fields of the structure that can have different types. A variable of that structure type holds the entire sequence defined by that type.
-
-
-
-
-