Some of you write about employee management , user management , banking application
What is the difference between linked list and arraylist
A linked list is a linear data structure where each element is a separate object that holds data and a pointer to the next element in the list. Linked lists are ideal for dynamic memory allocation, as they can grow or shrink in size as needed.
An ArrayList is a dynamic array that stores objects. It is similar to an array but can grow or shrink in size as needed. It is more efficient than a linked list for storing and retrieving data, but it does not offer the same flexibility when it comes to memory allocation and insertion/deletion operations.
A linked list is a linear data structure where each element is a separate object that holds data and a pointer to the next element in the list. Linked lists are ideal for dynamic memory allocation, as they can grow or shrink in size as needed.
An ArrayList is a dynamic array that stores objects. It is similar to an array but can grow or shrink in size as needed. It is more efficient than a linked list for storing and retrieving data, but it does not offer the same flexibility when it comes to memory allocation and insertion/deletion operations.
Instead of learning solutions of LeetCode questions, understand patterns! π
π΄πππ πΊπππ πππ πΊππππ !!!!
For ex.
If input array is sorted then
- Binary search
- Two pointers
If asked for all permutations/subsets then
- Backtracking
If given a tree then
- DFS
- BFS
If given a graph then
- DFS
- BFS
If given a linked list then
- Two pointers
If recursion is banned then
- Stack
If must solve in-place then
- Swap corresponding values
- Store one or more different values in the same pointer
If asked for maximum/minimum subarray/subset/options then
- Dynamic programming
If asked for top/least K items then
- Heap
If asked for common strings then
- Map
- Trie
Else
- Map/Set for O(1) time & O(n) space
- Sort input for O(nlogn) time and O(1) space
Link : https://t.me/teamJavaHydπππ
Check out a GitHub repo by Sean Prasad if you're interested to read more about this, it's absolutely amazing!
#leetcode #placements #dsa #interview #coding #preparation #consistency #quality #programming #softwareengineering #india #competitiveprogramming #datastructures #algorithms #connections #interviewpreparation
π΄πππ πΊπππ πππ πΊππππ !!!!
For ex.
If input array is sorted then
- Binary search
- Two pointers
If asked for all permutations/subsets then
- Backtracking
If given a tree then
- DFS
- BFS
If given a graph then
- DFS
- BFS
If given a linked list then
- Two pointers
If recursion is banned then
- Stack
If must solve in-place then
- Swap corresponding values
- Store one or more different values in the same pointer
If asked for maximum/minimum subarray/subset/options then
- Dynamic programming
If asked for top/least K items then
- Heap
If asked for common strings then
- Map
- Trie
Else
- Map/Set for O(1) time & O(n) space
- Sort input for O(nlogn) time and O(1) space
Link : https://t.me/teamJavaHydπππ
Check out a GitHub repo by Sean Prasad if you're interested to read more about this, it's absolutely amazing!
#leetcode #placements #dsa #interview #coding #preparation #consistency #quality #programming #softwareengineering #india #competitiveprogramming #datastructures #algorithms #connections #interviewpreparation