Top 8 Data Structures for Coding Interviews

Top 8 Data Structures for Coding Interviews

NeetCode

2 года назад

150,058 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Alan Carvajal
Alan Carvajal - 30.09.2023 21:35

I'm not sure if inserting to a hashmap is, by definition, O(1). It really depends on your hashing function. Your worst case to deal with hashing collisions will be by using a height balanced binary tree as collision structure, so this becomes O((logn)/k). If you never deal with collisions, then yeah O(1) is correct, but you'll need a really big starting array.

Ответить
Alexander Spurlock
Alexander Spurlock - 27.08.2023 04:56

Started my journey of getting ready for tech interviews… I have been watching your vids every chance I get!!

Ответить
Deep Learning Partnership
Deep Learning Partnership - 26.07.2023 01:41

Cool.

Ответить
Lokesh Pandey
Lokesh Pandey - 06.07.2023 16:32

Question: May be I am missing something ? But inserting or removing at the mid of linked list how it's O(1) unless we have a reference to the mid node, which in usual scenario we don't have that reference, in that case we have to loop to find the mid node and then insert or remove in this case it won't be constant.

Ответить
Bishnu Pada Chanda
Bishnu Pada Chanda - 02.07.2023 11:37

Regarding Linked list how it's possible to insert or remove in middle of the linked list in O(1)? How you will get the node of middle in constant time without storing the index of the nodes of the linked list?

Ответить
Satish Mankar
Satish Mankar - 11.05.2023 12:51

@NeetCode , One que, How time complexity of linked list for insert and delete will be O(1), first we need to traverse till that node right ?, which in worst case O(n). so O(n) + O(1) would be O(n) right ?

Ответить
Timur Confidential
Timur Confidential - 27.04.2023 00:44

When inserting/deleting from a linked list, don't you have to get the nodes 6 and 8 before inserting 7? But if you do, insert can't be O(1), since reading from a linked list is O(n)

Ответить
BARTU MUMCU
BARTU MUMCU - 22.04.2023 00:30

As far as I know, inserting an element at any position to a linked list is O(N) because you have to traverse and update your pointer untill that element. In the video it says O(1). How is this possible?

Ответить
John Pill
John Pill - 15.03.2023 22:14

Fantastic video!

Ответить
JOD Developer
JOD Developer - 27.12.2022 00:30

I think u need to iterate over the linked list to know the middle(as in the size) then iterate till you find the value in the linked list

Ответить
Thomas the real
Thomas the real - 09.12.2022 18:23

Is trhere any situation, where an array is faster or more efficient than a hashmap?

Ответить
Faysal
Faysal - 08.11.2022 06:35

Thanks you, I wish I had a job I would’ve send you more!

Ответить
shahak ahmad
shahak ahmad - 28.10.2022 01:15

Removing a node at the end is not constant. Not in a single linked list

Ответить
Denys Zheliezniak
Denys Zheliezniak - 15.10.2022 21:23

wouldn't for linked list insert and remove middle still be O(n) because you need to spend time navigating to that element?

Ответить
Don Hua
Don Hua - 12.09.2022 00:00

literally my uni course in 13min.

Ответить
fuhodev
fuhodev - 28.08.2022 10:04

Hi, I have two questions 1) how about disjoint set, is it important? 2) does an AI Engineer/ AI researcher need a lot of leetcode?

Ответить
Alex N
Alex N - 09.08.2022 18:44

why are hash maps said to have O(1) key search/access/insert time, when conflicts exist? Is there an implementation that works in O(1) in presence of conflicts?

I trust STL to be well implemented, and STL guarantees O(lg) for sorted and O(N) for unordered maps/sets.

Ответить
Ahmed Maa
Ahmed Maa - 07.08.2022 05:41

There are concrete like arrays and linked lists and maybe even trees and abstract data structures like graphs and hashtables..

Ответить