File: bst.html

package info (click to toggle)
jsxgraph 1.11.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,984 kB
  • sloc: javascript: 81,688; xml: 5,869; java: 1,072; php: 281; makefile: 189; python: 174; cpp: 76; sh: 12
file content (64 lines) | stat: -rw-r--r-- 1,470 bytes parent folder | download | duplicates (3)
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
<html>
<head>
    <title>JSXGraph example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
    <script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
    <script type="text/javascript" src="../src/math/bst.js"></script>
</head>
<body>
<h1>BST</h1>
<script type="text/javascript">

    var b = new JXG.Math.BST(),
        a = new JXG.Math.BST(),
        c = new JXG.Math.BST();
    b.init();
    a.init();
    c.init();

    var i, s = "Hallo, dies ist ein Text";
    s = "24135";
    for (i=0; i<s.length; i++) {
        b.insert(s[i]);
    }

    s = "Ein anderer String";
    for (i=0; i<s.length; i++) {
        a.insert(s[i]);
    }

    //b.insertHead('A');
    //b.deleteNode('A');

    //b.balance();
    //b.deleteNode('H');
    //b.head = b.rotL(b.head);

    //b.traverse(b.head, function(node){console.log(node.item);});
//console.log("RESULT");
    b.show();

    var n = b.search('3')
    console.log(n);
    console.log(b.next(n));
    console.log(b.prev(n));

//console.log("--------------");
    //a.show()
    //console.log(b.select(0));
//console.log("############");
//    c.head = b.joinRand(b.head,a.head);
//c.show();

/*    var h = new JXG.Heap();
    var i, s = "hallo ein xyz"; //, dies ist ein Text";
    for (i=0; i<s.length; i++) {
        h.insert(s[i]);
    }

    console.log(h.pq);
*/
</script>
</body>
</html>