|
28 | 28 | > The level of questions asked on the topic of Data Structures And Algorithms totally depends on the company for which you are applying.
|
29 | 29 |
|
30 | 30 | * Array
|
31 |
| - - An Array consists of a group of elements of the same data type. It is stored continuously in memory and by using its' index, you can find the underlying data. Arrays can be one dimensional and multi-dimensional. One dimensional array is the simplest data structure, and also most commonly used. It is worth noting that in Java language multi-dimensional array are implemented as arrays of arrays. For example, int[10][5] is actually one array with its' cells pointing to ten 5-element arrays. |
| 31 | + - An Array consists of a group of elements of the same data type. It is stored continuously in memory and by using its' index, you can find the underlying data. Arrays can be one dimensional and multi-dimensional. One dimensional array is the simplest data structure, and also most commonly used. It is worth noting that in Java language multi-dimensional array are implemented as arrays of arrays. For example, `int[10][5]` is actually one array with its' cells pointing to ten 5-element arrays. |
32 | 32 |
|
33 | 33 | | Algorithm | Average | Worst Case |
|
34 | 34 | |:---------:|:-------:|:----------:|
|
|
43 | 43 | anything, but the pointer is a reference to the next item in the LinkedList. A LinkedList
|
44 | 44 | contains both a head and a tail. The "Head" is the first item in the LinkedList, while the "Tail" is
|
45 | 45 | the last item. It is not a circular data structure, therefore the tail does not have its'
|
46 |
| - pointer pointing at the Head - the pointer is just NULL. The run time complexity for each of |
| 46 | + pointer pointing at the Head - the pointer is just `null`. The run time complexity for each of |
47 | 47 | the base methods are as follows:
|
48 | 48 |
|
49 | 49 | | Algorithm | Average | Worst Case |
|
|
54 | 54 | | Delete | Θ(1) | O(1) |
|
55 | 55 |
|
56 | 56 | * DoublyLinkedList
|
57 |
| - - A DoublyLinkedList is based on a LinkedList, but there is two pointers in each node, "previous" pointer holds reference to the previous node and "next" pointer holds reference to the next node. It also has a Head node, head node's next pointer references the first node in this DoublyLinkedList. The last node's "next" reference points to NULL, but if last node's next pointer points to the first node, such DoublyLinkedList is called "Circular DoublyLinkedList". This data structure is very convenient if you need to be able to traverse stored elements in both directions. |
| 57 | + - A DoublyLinkedList is based on a LinkedList, but there is two pointers in each node, "previous" pointer holds reference to the previous node and "next" pointer holds reference to the next node. It also has a Head node, head node's next pointer references the first node in this DoublyLinkedList. The last node's "next" reference points to `null`, but if last node's next pointer points to the first node, such DoublyLinkedList is called "Circular DoublyLinkedList". This data structure is very convenient if you need to be able to traverse stored elements in both directions. |
58 | 58 |
|
59 | 59 | 
|
60 | 60 |
|
|
65 | 65 | | Insert | Θ(1) | O(1) |
|
66 | 66 | | Delete | Θ(1) | O(1) |
|
67 | 67 | * Stack
|
68 |
| - - A Stack is a basic data structure with a "Last-in-First-out" (LIFO) semantics. This means that |
| 68 | + - A Stack is a basic data structure with a "Last-in-First-out" (LIFO) semantics. This means that |
69 | 69 | the last item that was added to the stack is the first item that comes out of the stack. A
|
70 | 70 | Stack is like a stack of books in that in order to get to the first book that was added in the stack
|
71 | 71 | (the bottom book), all of the books that were added after need to be removed first. Adding to a
|
|
74 | 74 | stack is by using a LinkedList, but there is also StackArray (implemented with an array)
|
75 | 75 | which does not replace null entries, and there is also a Vector implementation that does
|
76 | 76 | replace null entries. [Wikipedia](https://en.wikibooks.org/wiki/Data_Structures/Stacks_and_Queues#Performance_Analysis)
|
77 |
| - |
78 | 77 | <table>
|
79 | 78 | <tr>
|
80 | 79 | <th>Algorithm</th>
|
|
161 | 160 | </td>
|
162 | 161 | </tr>
|
163 | 162 | </table>
|
164 |
| - * Insertion sort |
| 163 | + * Insertion sort [Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort?oldformat=true) |
165 | 164 | <table>
|
166 | 165 | <tr>
|
167 | 166 | <th colspan="3" align="center">Time Complexity</th>
|
|
0 commit comments