forked from CuriousDrive/InterviewPreparation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notes.txt
53 lines (45 loc) · 1.64 KB
/
Notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
------ Data Structures ----
Stack
-> Push
-> Pop
-> Peek
-> TryPeek
-> TryPop
Queue
-> Enqueue
-> Dequeue
-> Peek
-> TryPeek
-> TryDequeue
SortedList
-> It's a KeyValue data structure
-> The keys get sorted as soon as they are inserted
-> There cannot to duplicate keys
-> Values can be null or duplicate
-> It's faster than List
Dictionary
-> Dictionary<TKey, TValue> stores key-value pairs.
-> Comes under System.Collections.Generic namespace.
-> Implements IDictionary<TKey, TValue> interface.
-> Keys must be unique and cannot be null.
-> Values can be null or duplicate.
-> Values can be accessed by passing associated key in the indexer e.g. myDictionary[key]
-> Elements are stored as KeyValuePair<TKey, TValue> objects.
Hashtable
-> Hashtable stores key-value pairs.
-> Comes under System.Collection namespace.
-> Implements IDictionary interface.
-> Keys must be unique and cannot be null.
-> Values can be null or duplicate.
-> Values can be accessed by passing associated key in the indexer e.g. myHashtable[key]
-> Elements are stored as DictionaryEntry objects.
Tuples
-> (double, int) t1 = (4.5, 3);
-> (double Sum, int Count) t2 = (4.5, 3);
-> var t = (Sum: 4.5, Count: 3);
-> t3 = t2;
------ Numbers ----
The Decimal, Double, and Float variable types are different in the way that they store the values.
Precision is the main difference where float is a single precision (32 bit) floating point data type,
double is a double precision (64 bit) floating point data type
and decimal is a 128-bit floating point data type.