Data Structures questions you might get asked on your interview

Where Next is a pointer to the next box
  • Numerical Computation
  • Operating System Design
  • Artificial Intelligence
  • Compiler Design
  • Database Handling
  • Graphical Processing
  • Lexical Analysis
  • Statistics
iterates through each element of the array
  • Linear Search— iterates through each element of the data structure until it finds the answer. The best case complexity is when O(1) (the element we search for is the first element in the array) and the worst when O(n) (the element we search for is the last element in the array).
Binary searching with the middlemost elements
  • Binary Search — splits the data structure into chunks and locates the specific element by comparing the middlemost items in the data collection. Base case complexity of O(1) and the average case complexity is the same as the worst case complexity — O(n log n). It uses the divide and conquer principle. Oops, forgot to say, Binary Search works only on sorted data collections.
  • You want to buy a limited pair of sneakers but the shop is doing a first come, first served type of sell — you arrive last at the shop, hence you have to wait the whole queue before you to be served — That’s a queue.
  • You play a game of Tower of Hanoi, where you stack a smaller disk over a bigger disk, right? Can you take the disk (the first placed disk) which you placed underneath all of the disks without removing the other disks — the answer is no! — That’s a stack.
2D array
void setName(string Name){
->Name = Name;
}
//does not have a return statement because the data type identifier
//is void
ExampleClass* obj1 = NULL;
//we can check what is the type of obj1, but if we have had declared //public methods, they cannot be called, because the pointer, actually //does not point to anything in the memory.
  • Allocation of dynamic memory — malloc() allocates dynamic memory, but does initialize it, while calloc() allocates dynamic memory and initializes all bits to 0s.
  • Deallocation of dynamic memory — free().
  • Reallocation of dynamic memory, if the previously allocated memory is not enough — realloc().
  • A variable is stored based on the amount of memory that is needed.
  • First, the required quantity of memory is assigned, and later is stored based on the data structure being used.
  • Using concepts such as dynamic allocation ensures high efficiency and that the storage units can be supplied based on the requirements in real time.
  • Min Heap — where the root node should hold the lowest key in the whole tree.
  • Max Heap — where the root node should hold the highest key in the whole tree.
  • Binary trees
  • Linked lists
  • Queues
  • Stacks
  • Dynamic data structures provide users with a lot of flexibility in terms of the provision of data storage and manipulation techniques.
  • Used to apply changes during the operation of the algorithm or the runtime of the program.

--

--

--

A computer science and business administration student with an interest in decentralized technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

👩‍💻🚀 Auto-Enriching Typeform CRM Using Webhooks Combined with Clearbit & Clay

Building a DevOps pipeline for your App: Git Strategy

Benchmarking Database

Aws lambda: 502 — Could not find the required ‘deps.json’

How to change the server region at AGE OF EMPIRES 4

DotNet Internals | C#

2/12Even if one software developer gets hired by the company you dreamt of, why isn’t you

As Networks Get Faster, High-Speed Storage Becomes More Important Than Ever

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Bozhilov

Michael Bozhilov

A computer science and business administration student with an interest in decentralized technologies

More from Medium

How to Reorder Data in Log Files having digit and letter logs?

Remove Stones to minimize the Total(code and Explanation)

Dynamic Programming-Parent Problem 1 (0/1 Knapsack): 3 approaches with practice questions.

knapsack problem image