forked from khan4019/front-end-Interview-Questions
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tree.html
212 lines (197 loc) · 9.24 KB
/
tree.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="that js dude" content="">
<title>JS: Tree related other questions</title>
<link rel="shortcut icon" href="images/favicon.jpg">
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="css/zenburn.css">
<!-- Custom styles for this template -->
<style>
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-bottom: 20px;
}
.purpleBold{
color:purple;
font-weight: bold;
}
.gray{
color: gray;
}
.blueish{
color: rgba(151, 182, 209, 0.98);
}
.singInStuff{
margin-top: 9px;
}
#uName{
margin-top: -7px;
}
.skipListItem{
list-style-type: none;
}
.skipListItem a{
color: inherit;
}
a:visited
{
color: rgba(218, 209, 149, 0.98);
}
.padding10Px{
padding: 10px;
}
/*style for demo*/
</style>
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>JS: Tree related other questions</h1>
<h4>Tree that relatd interview questions for expert JavaScript developers</h4>
<h2>part-7: expert</h2>
<p>June 29, 2014</p>
<!-- <div id="fb-root"></div><div class="fb-like" data-href="http://www.thatjsdude.com/interview/dom.html" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div><div class="g-plusone"></div> -->
</div>
</div>
<div class="container container-fluid">
<!-- Example row of columns -->
<div class="row center">
<!-- <iframe width="853" height="480" src="//www.youtube.com/embed/Rx_JFOSxgpY" frameborder="0" allowfullscreen></iframe> -->
</div>
<!-- <p class="gray">if you are little more comfortable or claim to be comfortable with javascript, these questions would not be enough for you. more coming</p>
<p class="gray"> <span class="purpleBold">More Questions</span> <a href="css.html">css interview questions</a>, <a href="html.html">html interview questions</a> </p> -->
<div id="questionList">
<h2>todo list</h2>
<ul>
<li>full, complete tree</li>
<li>red black tree</li>
<li>AVL tree</li>
<li>tries</li>
<li>R tree</li>
<li>n-ary Tree</li>
<li>B-Tree</li>
<li>B+ Tree</li>
<li>Dancing Tree</li>
<li>Decision Tree</li>
<li><a href="http://en.wikipedia.org/wiki/Minimal_spanning_tree">minimal spanning tree</a></li>
<li>heap</li>
</ul>
<h4>tree library</h4>
<ul>
<li><a href="https://www.npmjs.org/package/node-tree-data">node tree data</a></li>
<li><a href="http://jnuno.com/tree-model-js/">tree model</a></li>
<li><a href="https://github.com/mauriciosantos/buckets/">bucket</a></li>
<li><a href="https://github.com/aaronj1335/t-js">t.js</a></li>
<li><a href="https://github.com/stephen-james/DataStructures.Tree">data structure.Tree</a></li>
<li><a href="https://github.com/afiore/arboreal">arboreal</a></li>
</ul>
</div>
<div id="avlTree">
<h2>AVL tree</h2>
<p><strong>Question:</strong></p>
<p><strong>Answer:</strong></p>
</div>
<div id="trie">
<h2>Trie or Radix Tree or Prefix Tree</h2>
<p><strong>Question:</strong></p>
<p><strong>Answer:</strong></p>
<p>when you start typing in the search box of google, google gives you some auto suggestion. After typing one or two letters, google recommends you the complete word. This is done by trie data structure.</p>
<p> The name trie comes from its use for re<strong>trie</strong>val. It is pronounced like "try"</p>
<h4>Write in your own words</h4>
<p>a trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated with every node, only with leaves and some inner nodes that correspond to keys of interest. (copied from <a href="http://en.wikipedia.org/wiki/Trie">wiki</a>)</p>
</div>
<div id="trieInsert">
<h2>Trie Insert</h2>
<p><strong>Question:</strong></p>
<p><strong>Answer:</strong></p>
<p></p>
<p>ref: <a href="http://www.geeksforgeeks.org/trie-insert-and-search/">trie insert</a></p>
</div>
<div>
<h2>Questions list</h2>
<h4>from cracking the coding interview</h4>
<ul>
<li>fore directed graph, check whether there is a route between two node</li>
<li><a href="http://www.crazyforcode.com/tree/">carzy for code list of tree questions</a></li>
<li><a href="http://www.geeksforgeeks.org/forums/forum/trees-specific-questions/">geeks for geeks questions</a></li>
<li><a href="http://www.glassdoor.com/Interview/binary-trees-interview-questions-SRCH_KT0,12.htm">glassdoor questions</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLC3855D81E15BC990">you tube got some questions as well</a></li>
<li><a href="http://www.careercup.com/page?pid=trees-and-graphs-interview-questions">career cup list of question</a></li>
</ul>
</div>
<div>
<h3 class="purpleBold">Express anger!</h3>
<!-- <p class="gray">Feel free to express your anger (sorry folks, you have to use g+.). Also point out my mistakes ( technical, wrong answer, spelling, grammar, sentence..., whatever), let your dude learn and grow.</p>
<script src="https://apis.google.com/js/plusone.js"></script>
<div class="g-comments"
data-href="http://www.thatjsdude.com/interview/dom.html"
data-width="642"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div> -->
</div>
<hr>
<footer>
<p>©thatJSDude 2014</p>
</footer>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-2.0.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="js/toggleExample.js"></script>
<script type="text/javascript">
//social plugins
// //g+
// (function() {
// var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
// po.src = 'https://apis.google.com/js/platform.js';
// var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
// })();
// //fb
// (function(d, s, id) {
// var js, fjs = d.getElementsByTagName(s)[0];
// if (d.getElementById(id)) return;
// js = d.createElement(s); js.id = id;
// js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
// fjs.parentNode.insertBefore(js, fjs);
// }(document, 'script', 'facebook-jssdk'));
</script>
<script type="text/javascript">
document.getElementById('listToDestroy').addEventListener('click', function (e) {
var elm = e.target.parentNode;
elm.parentNode.removeChild(elm);
e.preventDefault();
});
document.getElementById('doubleHolder').addEventListener('click', function (e) {
if(e.target.classList.contains('double')){
var btn = document.createElement('button');
btn.setAttribute('class', 'double');
btn.innerHTML = 'double';
var btn2 = document.createElement('button');
btn2.setAttribute('class', 'double');
btn2.innerHTML = 'double';
this.appendChild(btn);
this.appendChild(btn2);
this.removeChild(e.target);
}
});
</script>
</body>
</html>