Skip to content

Instantly share code, notes, and snippets.

View kaniket7209's full-sized avatar
🎯
Focusing

kaniket7209

🎯
Focusing
View GitHub Profile
@kaniket7209
kaniket7209 / FAQ
Created October 26, 2021 08:44
Dynamic Queue
1. How many elements can we insert in a dynamic queue?
Answer: We can insert as many elements we want to use because it is automated in such a way that it doubles the size of itself if size becomes full , so it never shows stack overflow.
2. Can't we use circular queue despite making our custom dynamic queue?
Answer: Ya we can but that will not work for the case if we want to add the elements more than the size of parent queue and also we dont want to remove it. Because if we will use the circular queue it will add elements after removing the elements from first, So it would not meet our requirement as we need the data .
ex- Q1 contains 5 elements and we want to add 10 more elements and also we want to print it ,and also we need the data so that later on we can perform any other operation required so.
so we have to use custom dynamic queue inspite of circular queue
3. What are the types of algorithms in which queues are used?
Answer: a) Hashing may use queues to organize its partic
@kaniket7209
kaniket7209 / FAQ
Created October 26, 2021 10:57
Get value in Linked List
1. Which one is better, Array-List or Linked-List and Why?
Answer:Linked List , Advantages and reasons are below:-
a) In array elements are stored in consecutive memory locations. ( i.e if address of 1st element is 100 then address it next element is 101 provided that one element of array consumes only one byte in memory ) But In linked list , Nodes of linked list are scattered in memory it means addresses of elements are not consecutive but still they are connected to each other through link which contains address of it's next node or element.
b) Insertion and deletion inside array is not efficient since it requires shifting of elements.For example if we want to insert an element at the 0th position then we have to shift all the elements of array to the right and if we have to delete element present at 0th position then we have to shift all the elements to the left..( It means insertion and deletion is not that easy in array.. it is more time consuming ) But in linked list we can easily do th
@kaniket7209
kaniket7209 / FAQ
Last active October 26, 2021 12:15
Level Order Linewise Traversal
1. Can we use any other data structure despite queue to travel linewise?
Answer: Yes we can use stack also. But we have to use 2 stacks for it.
2. Can we travel linewise just with a single queue?
Answer: Yes we can but, we have to use 2 while loops for that .
3. Can we use recursion to tarvel linewise in tree?
Answer: Yes we can but we have to use extra parameters for levels.
4. Can we use hashmap functionality to travel linewise?
@kaniket7209
kaniket7209 / FAQ
Created October 26, 2021 12:25
Level Order Traversal Of Binary Tree
1. Can we use hashmap functionality to travel linewise in binary tree?
Answer: Yes we can assign keys for different levels and store the values of childrens in levels and do so.
2. Can we use recursion to tarvel linewise in binary tree?
Answer: Yes we can but we have to use extra parameters for levels.
3. Can we use any other data structure despite queue to travel linewise in binary tree?
Answer: Yes we can use stack also.
@kaniket7209
kaniket7209 / FAQ
Created October 26, 2021 13:26
Size, Sum, Max, Min & Find in BST
1. What will happen to a Binary Search Tree if we have two equal values in our “list” ?
Answer: The same element wull be treated as a greater one with parent and will be placed in right side of that node.
2. When the length of our list is even , which element to be picked up as a root node for a list ?
Answer: It depends upon the question .
3. Why inorder of BST is always sorted ?
Answer: Because the value less than the node is always in left part of the node and value greater than the node is always in right part of the node following bst algo.
@kaniket7209
kaniket7209 / FAQ
Created October 27, 2021 05:21
Get Common Elements-2
1. What will happen if we try to store a key that is already present in HashMap?
Answer: If you store an existing key in the HashMap, then it will override the old value with the new value, and put() will return the old value. There will not be any exception or error.
2. Which data structure is used to implement HashMap in Java?
Answer: Even though HashMap represents a hash table, it is internally implemented by using an array and linked list data structure in JDK. The array data structure is used as a bucket, while a linked list is used to store all mappings which land in the same bucket.
3. Can we sort HashMap in Java?
Answer: No, we cannot sort a HashMap because, unlike List, it is not an ordered collection. Although, we can sort contents of HashMap by keys, values, or by entries by sorting and then storing the result into an ordered map like LinkedHashMap or a sorted map e.g., TreeMap.
4. How does resize happens in HashMap?
@kaniket7209
kaniket7209 / FAQ
Last active October 29, 2021 11:50
Practical Introduction to Node.js | Node.js
1. Why we use back-ticks (``) rather than the quotes ("") to define a string?
Answer: Because with template literals, we can use both single and double quotes inside a string and also it allows multiline strings.
2. How can we change variables inside a string ?
Answer: By using template literals (back tick ).
3. What is the syntax of using variables inside a string. State an example .
Answer: let a = "Pep";
let b = "Coding";
let res = `Welcome to ${a}, ${b}!`;
@kaniket7209
kaniket7209 / FAQ
Last active November 1, 2021 05:07
Practical Introduction to JavaScript| JavaScript
1. What is the difference between "==" and "===" operators ?
Answer: The difference between both the comparison operators is that,“==” is used to compare values whereas, “ === “ is used to compare both value and types.
2. Suppose we have a following code below ?
let x = 1;
let y = "1";
console.log(x+y, "---" , x-y);
Why x+y converts it in String and prints 11 and x-y converts that in number and prints 0 ?
Answer: This is because Javascript uses the '+' operator for two things :
i) If JS sees that operands of both the expression are number then it simply performs the addition operation.
Do refer to this FAQ's also as this project mainly comprises of the concepts from the previous two videos . Solve this also...
1. Practical Introduction to JavaScript
Link - https://gist.github.com/kaniket7209/e4e36c8059287712114924ea290b2e3c
2. Pracatical Introduction to Node Js
Link - https://gist.github.com/kaniket7209/e6215aaa2f0a1c06d26f54350e601ccd
@kaniket7209
kaniket7209 / FAQ
Last active November 1, 2021 13:13
Practical Introduction to Web Scraping with Node.js | Cheerio Request
1. What is Request Response Cycle .How it works ?
Answer: This is a kind of cycle where a user gives a client a URL and the client builds a request for information, generated by a server.
Once built ,that response is sent back to the client in the requested format, to be rendered by the user.
2. What are the basic steps of Web-Scrapping Process?
Answer: The steps are:
a) Firstly, with the help of Node.js modules we send the request to browser/machine.
b) Browser then in response returns a html file.
c) We will parse/read with the help of node.js modules .
d) Extract the data from it in then display it in a organised format such a excel,pdf ,etc.