0% found this document useful (0 votes)
13 views8 pages

Data Structures Interview Questions

The document provides an extensive overview of data structures including arrays, linked lists, stacks, queues, heaps, hashes, and trees, along with their definitions, types, and operations. It also lists various problems and challenges associated with each data structure for practice. Additionally, it covers fundamental concepts like time complexity, exceptions, and specific algorithms related to these data structures.

Uploaded by

Khwaja Moinuddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Data Structures Interview Questions

The document provides an extensive overview of data structures including arrays, linked lists, stacks, queues, heaps, hashes, and trees, along with their definitions, types, and operations. It also lists various problems and challenges associated with each data structure for practice. Additionally, it covers fundamental concepts like time complexity, exceptions, and specific algorithms related to these data structures.

Uploaded by

Khwaja Moinuddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Array

What is an array?
Can an array be resized at runtime?
What is the time complexity for accessing an element in an array?
What is the difference between an array and a linked list?
How would you find the smallest and largest element in an array?
Explain the concept of a multi-dimensional array.
What is the difference between an array and a linked list?
How would you find the smallest and largest element in an array?
Explain the concept of a multi-dimensional array
What is an array index out of bounds exception?
How would you reverse an array in-place in linear time and constant space?
Explain the concept of a jagged array.
How can you find duplicate elements in an array?
Discuss the advantages and disadvantages of using arrays.
Explain the concept of a sparse array.
What is the difference between an array and a list?

PROBLEMS
Find a peak element which is not smaller than its neighbours.
Find the minimum and maximum element in an array.
Write a program to reverse the given array .
Write a program to sort the given array with least time and space complexity.
Find the kth largest and kth smallest number in an array
Find the occurrence of an integer in the array
Sort the array of 0s,1s,and 2s
Subarray with given sum
Move all the negative elements to one side of the array
Find the union and intersection of the two sorted arrays
Find the missing integer
Count pairs with the given sum
Find duplicates in an array
Sort an array using quicksort algorithm
Find a triplet that sums to a given value
Print the given matrix in a spiral manner
Array implementation of stack
Solve chocolate distribution problem
Coin change problem

LINKEDLIST
WHAT IS A LINKED LIST

TYPES OF LINKED LIST

WHAT IS CYCLE OR LOOP IN SINGLY LINKED LIST

TIME COMPLEXITY OF LINKED LIST OPERATION

DYNAMIC ARRAY AND LINKED LISTS WHAT I S THE DIFFERENCE

PROBLEMS

ROTATE A LINKED LIST

DELETE LAST OCCURRENCE OF AN ITEM FROM LINKED LIST

PAIRWISE SWAP OF A LINKED LIST

REMOVE ALL OCCURRENCES OF ONE LINKED LIST IN ANOTHER LINKED LIST

INTERSECTION POINT IN “Y” SHAPED LINKED LIST

CONVERT A BINARY TREE INTO DOUBLY LINKED LIST IN SPIRAL FASHION

CONSTRUCT A LINKED LIST FROM A 2D MATRIX

FLATTENING A LINKED LIST

PARTITION A LINKED LIST AROUND A GIVEN VALUE

CLONE A LINKED LIST WITH RANDOM POINTERS

REVERSE A LINKED LIST IN GROUPS OF GIVEN SIZE

REARRANGE A GIVEN LINKED LIST IN-PLACE

WHAT IS A NULL POINTER EXCEPTION

DESIGN A HASHMAP

DESIGN SKIPLIST

DESIGN BROWSER HISTORY

DESIGN A TEXT EDITOR


STACK
OPERATIONS IN STACK

STACK UNDERLOW AND OVERFLOW

EVALUATING POSTFIX EXPRESSION

BALANCED PARENTHESIS EXPRESSION

PROBLEMS

HOW TO IMPLEMENT A QUEUE USING TWO STACKS

SORT A STACK USING A TEMPORARU STACK

INFIX TO POSTFIX CONVERSION USING STACK

DELETE CONSECUTIVE SAME WORDS IN A SEQUENCE

USE ITERATIVE APPROACH TO CHECK IF A BINARY TREE IS BST OR NOT

CLONE A STACK WITHOUT USING EXTRA SPACE

SOLVE THE CELEBRITY PROBLEM

FIND THE LARGEST RECTANGULAR AREA POSSILBE IN A GIVEN HISTOGRAM

FIND MAXIMUM PEOPLE A PERSON CAN SEE WHILE STANDING IN A LINE IN BOTH DIRECTIONS

PRINT ANCESTORS OF A GIVEN BINARY TREE NODE WITHOUT RECURSION

CREATE A ZUMA GAME

PARSE LISP EXPRESSION

CAR FLEET PROBLEM

ONLINE STOCK SPAN

CLUMSY FACTORIAL

PARSING A BOOLEAN EXPRESSION

DINNER PLATE STACKS

CRAWLER LOG FOLDER

DESIGN A TEXT EDITOR


QUEUE

FIFO

HOW TO HANDLE OVERFLOW AND UNDERFLOW CONDITIONS IN A QUEUE

WHAT IS A DOUBLE ENDED QUEUE

IMPLEMENTATION OF PRIORITY QUEUE

EXPLAIN CIRCULAR QUEUE

WHAT ARE THE APPLICATIONS OF QUEUES

PROBLEMS

PRINT ALL ELEMENTS OF A QUEUE IN A NEW LINE

IMPLEMET A QUEUE USING A ARRAY

CHECK IF A QUEUE CAN BE SORTED INTO ANOTHER QUEUE USING A STACK

REVERSE A QUEUE USING RECURSION

SOLVE MINIMUM STEPS TO REACH TARGET BYHA KNIGHT

SHORTEST DISTANCE IN A MAZE

GEEK IN A MAZE

FIND SHORTEST SAFE ROUTE IN A PATH WITH LANDMINES

TRAPPING RAIN WATER PROBLEM

TURN A QUEUE INTO A PRIORITY QUEUE


HEAP
HUFFMAN CODING

NETWORK ROUTING

WHAT IS A HEAP

HOW TO CONVERT BST INTO A HEAP

MERGING OF TWO HEAPS

DIJKSTRA’S ALGORITHM

PROBLEMS

IMPLEMENT MIN AND MAX HEAP

IMPLEMENT A PRIORITY QUEUE

HUFFMAN ENCODING

DESIGN A GAME WIITH STRING

FIND THE MEDIAN OF A STREAM OF RUNNING INTEGERS

FIND THE MINIMUM COST TO CONNECT ALL CITIES

HASH

WHAT IS A HASH TABLE AND HASH KEY

WHAT IS COLLISION RESOLUTION

WHAT IS CHANINING

CUCKOO HASHING

LOAD FACTOR

WHAT IS A BLOOM FILTERS

PROBLEMS

FIND THE ONLY REPETETITIVE ELEMENT BETWEEN 1 TO N

LONGEST CONSECUTIVE SUBSEQUENCE

IMPLEMENT LRU CACHE

LENGTH OF LONGEST STRICT BITONIC SUBSEQUENCE


FIND NUMBER OF EMPLOYEES UNDER EVERY MANAGER

FIND ALL DUPLICATE SUBTREE

FIND ALL SYMMETIRC PAIRS IN AN ARRAY OF PAIRS

3-PARTITION PROBLEM

FLOYDS CYCLE DETECTION ALGORITHM

ISOMORPHIC STRINGS

TREE

TYPES OF TREES

EXPLAIN RED BLACK TREE

TREE TRAVERSAL

WHEN TO USE TREE DATA STRUCTURE?

WHAT IS SELF BALANCING TREE?

MINIMMUN SPANNING TREE?

HOW TREE USE TO REPRESENT GAME STATES AND POSSIBLE ACTIONS, EXPLAIN USING A SIMPLE
GAME?

PROBLEMS

ZIGZAG TREE TRAVERSAL

BURN BINARY TREE

FIND MEDIAN OF BST

CHECK IF BINARY TREE IS A HEAP

FLOOR AND CEIL FROM A BST

PROBLEMS FOR PRACTISE

Find even or odd


Find last digit in a number
Count digits in a number(Solving above last digit prob wil make this easy for you)
Reverse a number(Try thinking how you can use above logic in solving this)
Find power of a number
GCD
Print all divisors of a number
Prime number(Try solving by yourself)
Armstrong number(Solving power of number, will make this easy for you)
Check palindrome of number(Use the techniques you learnt so far solving above probs and solve this by
yourself)
Square root of a number(Try to first figure out algo to solve this)
Perfect number
Find the maximum and minimum element in array

Find 3rd largest element in the array

Union and intersection of two arrays

Rotate an array by 1

Rotate an array by k

Trapping rain water problem

Kadanes Algorithm

You might also like