In this video, we are going to talk about how to choose a right data structure in your coding Interview.
If you want to crack a coding Interview, you will need to write the best algorithm for solving it, and if you want to write best algorithm, you will need to pick a right data structure.
To pick a right data structure, first you will need to understand the pros and cons of all the data structures. Since we can't talk about all the data structures in this video, we are going to talk about 5 basic data structures that are widely asked in Coding Interviews.
1. Arrays 01:50
Arrays are the first and basic data structure that any programmer may encounter in their programming life.
When you define arrays, a continuous block of memory is allocated for your array.
2. Hash Tables 02:40
Hash Tables are also similar to that of Arrays except that instead of continuous blocks of memory, you will have keys, values and Hash function.
When you pass this key to Hash function, it returns a memory location by performing some calculations on the key, and the value is stored at this memory location.
3. Linked Lists 03:55
In Linked Lists, we have nodes. Each node contains data value and a pointer which points to next element. We can add any number of nodes to a Linked List. This gives the flexibility of adding any number of elements dynamically.
4. Stacks and Queues 05:23
Stacks work on the concept of Last In First Out. The last element added to the data structure is the first element to get out of the data structure. If you put an element in Stack, it is push operation. If you get an element out, it is Pop operation.
Queues work on the concept of First In First Out. The first element added to the data structure is the first element to get out of the data structure. If you put an element in Queue, it is an Enqueue operation. If you get an element out, it is Dequeue operation.
5. Trees 06:49
Trees are similar to that of Linked List except that instead of head node, you have root node, and each node is a parent of other child nodes.
If a tree has a restriction that each node can contain at most two nodes, then it is called Binary tree.
If there is an additional restriction on Binary tree that left node value is less than the root node value, and root node value is less that right node value, then it is called Binary Search Tree.
If there is additional restriction that all nodes except for leaf nodes contain two child nodes, then it is a balanced tree, else it is unbalanced.
When you know the basics of all the data structures, and you have a coding question at your hand, you will need to analyze the question and draw the requirements. Based on the requirements you will need to choose which data structure is good choice.
Subscribe to Sprint Master Channel: / @sprintmaster
More videos:
How I prepare for my Amazon Interview: • How I cracked my Amazon Coding Interview |...
How to solve a Coding Interview Question: • How to solve a Coding Question in a Techni...
What is an Array? • Overview of Arrays Data structure | When t...
Playlists:
Coding Interview Preparation Playlist: • How I cracked my Amazon Coding Interview |...
Knowledge Tap Series: • Overview of Arrays Data structure | When t...
#datastructures #coding #interviews #programminginterviews
Auf dieser Seite können Sie das Online-Video Choosing a right data structure in Coding Interviews mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Sprint Master 29 Januar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9,250 Mal angesehen und es wurde von 389 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!