1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5819],{96186:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/learn-experiment3",function(){return n(20626)}])},34798:function(e,t,n){"use strict";n.r(t),n.d(t,{ArrayDiagram:function(){return h},Arrow:function(){return c},H:function(){return s}});var r=n(14924),i=n(26042),a=n(69396),o=n(85893),l=n(67294),s=function(e){return{value:e,highlight:!0}},c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="object"===typeof e&&e.hasOwnProperty("value")?e:{value:e};return(0,a.Z)((0,i.Z)({},n),{arrow:!0,label:t})},d=function(e,t){return String(e).length*t*.5},h=function(e){var t=e.items,n=void 0===t?[]:t,r=e.cellSize,s=void 0===r?50:r,c=e.fontSize,h=void 0===c?20:c,u=e.showIndexes,x=void 0!==u&&u,g=e.indexFontSize,f=void 0===g?16:g,v=e.labelFontSize,m=void 0===v?16:v,p=(0,l.useRef)(null),y=(0,l.useState)("0 0 100 100"),j=y[0],w=y[1],b=(0,l.useState)({width:0,height:0}),S=b[0],k=b[1];(n=function(e){return e.map((function(e){return Array.isArray(e)?e.map((function(e){return"object"===typeof e&&e.hasOwnProperty("value")?e.value:e})).join(", "):"object"===typeof e&&e&&e.hasOwnProperty("value")?e:"object"===typeof e?JSON.stringify(e):"string"===typeof e?e.replace(/\[object Object\]/g,(function(e){try{return JSON.stringify({})}catch(t){return e}})):e}))}(n)).includes("<null>")&&(n=function(e){var t=JSON.stringify(e).replace(/"<null>"/g,"");return new Function("return ".concat(t))()}(n)),Array.isArray(n)&&0!==n.length||(n=[" "]);var N=n.map((function(e){var t,n,r,i,a,o,l,c;"object"===typeof e&&e.hasOwnProperty("value")?(t=(a=e).value,n=void 0!==(o=a.highlight)&&o,r=void 0!==(l=a.arrow)&&l,i=void 0===(c=a.label)?"":c):(t=e,n=!1,r=!1,i="");"object"===typeof t&&null!==t?t=JSON.stringify(t):"string"===typeof t&&(t=t.replace(/\[object Object\]/g,(function(e){try{return JSON.stringify({})}catch(t){return e}})));var u=d(t,h)+10,x=d(i,m)+10;return{value:t,highlight:n,arrow:r,label:i,width:Math.max(s,u,x)}})),E=N.reduce((function(e,t){return Math.max(e,t.width)}),0),A=N.map((function(e){return(0,a.Z)((0,i.Z)({},e),{width:E})}));A.length;return(0,l.useLayoutEffect)((function(){if(p.current){var e=p.current.getBBox(),t=e.width+40,n=e.height+40,r="".concat(e.x-20," ").concat(e.y-20," ").concat(t," ").concat(n);j!==r&&w(r),S.width===t&&S.height===n||k({width:t,height:n})}}),[n,S,j]),(0,o.jsx)("div",{style:{width:"100%",height:"".concat(S.height,"px"),minHeight:"100px"},children:(0,o.jsx)("svg",{ref:p,width:"100%",height:"100%",viewBox:j,preserveAspectRatio:"xMidYMid meet",children:A.map((function(e,t){var n=t*E;return(0,o.jsxs)("g",{children:[e.arrow&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("text",{x:n+e.width/2,y:8,textAnchor:"middle",dominantBaseline:"central",fontSize:m,fill:"black",children:e.label}),(0,o.jsx)("path",{d:"M ".concat(n+e.width/2," 18 L ").concat(n+e.width/2," ").concat(s/2+13," L ").concat(n+e.width/2-5," ").concat(s/2+8," M ").concat(n+e.width/2," ").concat(s/2+13," L ").concat(n+e.width/2+5," ").concat(s/2+8),fill:"none",stroke:"black",strokeWidth:"2"})]}),(0,o.jsx)("rect",{x:n,y:40,width:e.width,height:s,fill:e.highlight?"yellow":"white",stroke:"black"}),(0,o.jsx)("text",{x:n+e.width/2,y:40+s/2,textAnchor:"middle",dominantBaseline:"central",fontSize:h,children:String(e.value)}),x&&(0,o.jsx)("text",{x:n+e.width/2,y:s+55,textAnchor:"middle",dominantBaseline:"central",fontSize:f,fill:"gray",children:t})]},t)}))})})};t.default=function(){return(0,o.jsxs)("div",{style:{backgroundColor:"white"},children:[(0,o.jsxs)("h2",{children:["Array [1, 2, ","D","] with highlighted ","D",":"]}),(0,o.jsx)(h,{items:[1,2,s("D")],showIndexes:!0}),(0,o.jsx)("h2",{children:"Another array"}),(0,o.jsx)(h,{items:[c(s(1),"val at i"),2,3],showIndexes:!0}),(0,o.jsx)(h,{items:[c(1,"hello world"),c(2,"hello world"),c(3,"hello world"),4]}),(0,o.jsx)(h,{items:["Optimal substructure","Greedy choice property",s("Simple problems"),"Approximation needed"]}),(0,o.jsx)(h,{items:[["Test"],"Yo","Yes"]}),(0,o.jsx)("h1",{className:"text-2xl font-bold mb-4",children:"ArrayDiagram Bug Reproduction Tests"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"1. Original Bug Attempt:"}),(0,o.jsx)(h,{items:[{specific:!0},{measurable:!0}],showIndexes:!0})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"2. Attempt to reproduce [object Object]hello:"}),(0,o.jsx)(h,{items:[{},"hello"],showIndexes:!0})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"3. Alternative attempt:"}),(0,o.jsx)(h,{items:[{toString:function(){return"[object Object]hello"}}],showIndexes:!0})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"4. Using template literals:"}),(0,o.jsx)(h,{items:["".concat({})],showIndexes:!0})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"5. Combining object and string:"}),(0,o.jsx)(h,{items:[{}+"hello"],showIndexes:!0})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"6. Using Object.prototype.toString:"}),(0,o.jsx)(h,{items:[(0,r.Z)({},Symbol.toPrimitive,(function(){return Object.prototype.toString.call({})+"hello"}))],showIndexes:!0})]})]})}},46032:function(e,t,n){"use strict";n.r(t),n.d(t,{GraphDiagram:function(){return a}});var r=n(85893),i=n(67294),a=function(e){var t=e.nodes,n=e.edges,a=e.directed,o=void 0!==a&&a,l=e.width,s=void 0===l?500:l,c=e.he
1ight,d=void 0===c?300:c,h=e.nodeRadius,u=void 0===h?20:h,x=e.fontSize,g=void 0===x?16:x,f=e.arrowSize,v=void 0===f?6:f,m=e.edgeLabelFontSize,p=void 0===m?12:m,y=(0,i.useState)({}),j=y[0],w=y[1];(0,i.useEffect)((function(){var e={},n=s/2,r=d/2,i=Math.min(s,d)/3;t.forEach((function(a,o){var l=o/t.length*2*Math.PI;e[a.id]={x:n+i*Math.cos(l),y:r+i*Math.sin(l)}})),w(e)}),[t,s,d]);var b=function(e){var t=e.node,n=e.x,a=e.y,o=(0,i.useRef)(null),l=(0,i.useState)(0),s=l[0],c=l[1],d=String(t.value);(0,i.useEffect)((function(){o.current&&c(o.current.getBBox().width)}),[d]);var h=Math.max(s+10,2*u),x=2*u;return(0,r.jsxs)("g",{children:[(0,r.jsx)("ellipse",{cx:n,cy:a,rx:h/2,ry:x/2,fill:t.highlight?"yellow":"white",stroke:"black"}),(0,r.jsx)("text",{ref:o,x:n,y:a,textAnchor:"middle",dominantBaseline:"central",fontSize:g,children:d})]})},S=function(e){var t=e.startNode,n=e.endNode,i=e.label,a=j[t],l=j[n];if(!a||!l)return null;var s=l.x-a.x,c=l.y-a.y,d=Math.atan2(c,s),h=u+2,x=o?u+v+2:u+2,g=a.x+h*Math.cos(d),f=a.y+h*Math.sin(d),m=l.x-x*Math.cos(d),y=l.y-x*Math.sin(d),w=(g+m)/2,b=(f+y)/2,S=-10*Math.sin(d),k=10*Math.cos(d);return(0,r.jsxs)("g",{children:[o&&(0,r.jsx)("defs",{children:(0,r.jsx)("marker",{id:"arrowhead-".concat(t,"-").concat(n),markerWidth:v,markerHeight:v,refX:"0",refY:v/2,orient:"auto",children:(0,r.jsx)("polygon",{points:"0 0, ".concat(v," ").concat(v/2,", 0 ").concat(v),fill:"black"})})}),(0,r.jsx)("line",{x1:g,y1:f,x2:m,y2:y,stroke:"black",strokeWidth:"2",markerEnd:o?"url(#arrowhead-".concat(t,"-").concat(n,")"):void 0}),i&&(0,r.jsx)("text",{x:w+S,y:b+k,textAnchor:"middle",dominantBaseline:"central",fontSize:p,fill:"blue",children:i})]})};return(0,r.jsxs)("svg",{width:s,height:d,children:[(0,r.jsx)("g",{children:n.map((function(e,t){return(0,r.jsx)(S,{startNode:e.start,endNode:e.end,label:e.label},"edge-".concat(t))}))}),(0,r.jsx)("g",{children:t.map((function(e){var t,n;return(0,r.jsx)(b,{node:e,x:(null===(t=j[e.id])||void 0===t?void 0:t.x)||0,y:(null===(n=j[e.id])||void 0===n?void 0:n.y)||0},e.id)}))})]})};t.default=function(){var e={nodes:[{id:"1",value:"A"},{id:"2",value:"B",highlight:!0},{id:"3",value:"C"},{id:"4",value:"D"},{id:"5",value:"E"}],edges:[{start:"1",end:"2",label:"5"},{start:"1",end:"3",label:"3"},{start:"2",end:"4",label:"7"},{start:"3",end:"4",label:"1"},{start:"4",end:"5",label:"2"},{start:"5",end:"1",label:"4"}]},t={nodes:[{id:"1",value:"A",highlight:!0},{id:"2",value:"B"},{id:"3",value:"C"}],edges:[{start:"1",end:"2",label:"optional label"},{start:"2",end:"3"},{start:"3",end:"1"}]};return(0,r.jsxs)("div",{className:"p-4 bg-white",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold mb-4",children:"Flexible Graph Diagram"}),(0,r.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Weighted Directed Graph:"}),(0,r.jsx)(a,{nodes:t.nodes,edges:t.edges,directed:!0}),(0,r.jsx)("h2",{className:"text-xl font-semibold my-4",children:"Weighted Undirected Graph:"}),(0,r.jsx)(a,{nodes:e.nodes,edges:e.edges,directed:!1}),(0,r.jsx)("p",{children:"Graph Text"}),(0,r.jsx)(a,{directed:!0,nodes:[{id:"1",value:"A",highlight:!0},{id:"2",value:"B",highlight:!0},{id:"3",value:"C"},{id:"4",value:"D",highlight:!0}],edges:[{start:"1",end:"2"},{start:"1",end:"3"},{start:"2",end:"4"},{start:"3",end:"4"}]})]})}},33697:function(e,t,n){"use strict";n.r(t),n.d(t,{KeyValuePairs:function(){return a}});var r=n(29815),i=n(85893),a=(n(67294),function(e){var t,n,a=e.pairs,o=e.cellHeight,l=void 0===o?40:o,s=e.fontSize,c=void 0===s?16:s,d=e.padding,h=void 0===d?10:d,u=(t=Math).max.apply(t,(0,r.Z)(a.map((function(e){return String(e.key).length}))))*c*.6+2*h,x=(n=Math).max.apply(n,(0,r.Z)(a.map((function(e){return String(e.value).length}))))*c*.6+2*h,g=u+x,f=a.length*l;return(0,i.jsx)("svg",{width:g,height:f,children:a.map((function(e,t){return(0,i.jsxs)("g",{children:[(0,i.jsx)("rect",{x:0,y:t*l,width:u,height:l,fill:e.highlight?"yellow":"white",stroke:"black"}),(0,i.jsx)("rect",{x:u,y:t*l,width:x,height:l,fill:e.highlight?"yellow":"white",stroke:"black"}),(0,i.jsx)("text",{x:u/2,y:t*l+l/2,textAnchor:"middle",dominantBaseline:"central",fontSize:c,children:String(e.key)}),(0,i.jsx)("text",{x:u+x/2,y:t*l+l/2,textAnchor:"middle",dominantBaseline:"central",fontSize:c,children:String(e.value)})]},t)}))})});t.default=function(){return(0,i.jsxs)("div",{style:{backgroundColor:"white",padding:"20px"},children:[(0,i.jsx)("h2",{children:"Key-Value Pairs Example:"}),(0,i.jsx)(a,{pairs:[{key:"Name",value:"[1,2,3]"},{key:1,value:30,highlight:!0},{key:"City",value:"New York"},{key:2,value:"Software Engineer"}]})]})}},33344:function(e,t,n){"use strict";n.r(t),n.d(t,{H:function(){return a},LinkedListDiagram:function(){return o}});var r=n(85893),i=n(67294),a=function(e){return{value:e,highlight:!0}},o=function(e){var t=e.list,n=e.nodeHeight,a=void 0===n?50:n,o=e.nodeWidth,l=void 0===o?80:o,s=e.nodeSpacing,c=void 0===s?60:s,d=e.fontSize,h=void 0===d?20:d,u=e.arrowWidth,x=void 0===u?50:u,g=(0,i.useRef)(null),f=(0,i.useState)("0 0 100 100"),v=f[0],m=f[1],p=(0,i.useMemo)((function(){if(!t||!t.head)return[];for(var e=[],n=t.head;n;)e.push(n),n=n.next;return e}),[t]),y=(0,i.useRef)(p);(0,i.useEffect)((function(){y.current=p}),[p]),(0,i.useEffect)((function(){if(g.current){var e=g.current.getBBox();m("".concat(e.x-20," ").concat(e.y-20," ").concat(e.width+40," ").concat(e.height+40))}}),[]);var j=function(e){var t=e.x,n=e.y,i=e.value,o=e.highlight;return(0,r.jsxs)("g",{children:[(0,r.jsx)("rect",{x:t-l/2,y:n-a/2,width:l,height:a,fill:o?"yellow":"white",stroke:"black",strokeWidth:"2"}),(0,r.jsx)("line",{x1:t+l/2-25,y1:n-a/2,x2:t+l/2-25,y2:n+a/2,stroke:"black",strokeWidth:"2"}),(0,r.jsx)("text",{x:t-15,y:n,textAnchor:"middle",dominantBaseline:"central",fontSize:h,children:String(i)})]})},w=function(e){var t=e.x,n=e.y;return(0,r.jsx)("text",{x:t,y:n,textAnchor:"middle",dominantBaseline:"central",fontSize:h,children:"NULL"})},b=function(e){var t=e.x1,n=e.y1,i=(e.x2,e.y2),a=t+l/2,o=t+l/2+x;return(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:a,y1:n,x2:o,y2:i,stroke:"black",strokeWidth:"2"}),(0,r.jsx)("polygon",{points:"0,".concat(-4," ").concat(10,",0 0,").concat(4),fill:"black",transform:"translate(".concat(o,",").concat(i,")")})]})};if(!t||!t.head)return(0,r.jsx)("div",{style:{color:"red",padding:"10px",border:"1px solid red"},children:"Please provide a valid linked list structure."});p.length;var S=l/2,k=a;
1return(0,r.jsxs)("svg",{ref:g,width:"100%",height:"auto",style:{maxHeight:"80px"},viewBox:v,children:[p.map((function(e,t){var n=S+t*(l+c),a=e.value.hasOwnProperty("value")?e.value.value:e.value,o=e.value.hasOwnProperty("highlight")&&e.value.highlight;return(0,r.jsxs)(i.Fragment,{children:[(0,r.jsx)(j,{x:n,y:k,value:a,highlight:o}),(0,r.jsx)(b,{x1:n,y1:k,x2:n+l+c,y2:k})]},t)})),(0,r.jsx)(w,{x:S+p.length*(l+c)+x-50,y:k})]})};t.default=function(){a(10);return(0,r.jsxs)("div",{style:{backgroundColor:"white",padding:"20px"},children:[(0,r.jsx)("h2",{children:"Linked List Diagram with Highlighted Node:"}),(0,r.jsx)(o,{list:{head:{value:1,next:{value:2,next:{value:3,next:{value:4,next:{value:5,next:{value:6,next:{value:7,next:null}}}}}}}}})]})}},32828:function(e,t,n){"use strict";n.r(t),n.d(t,{MatrixTable:function(){return a}});var r=n(29815),i=n(85893),a=(n(67294),function(e){var t=function(e){var t,i=n.map((function(t){return String("object"===typeof t[e]?t[e].value:t[e])})),a=(t=Math).max.apply(t,(0,r.Z)(i.map((function(e){return e.length}))));a>4&&(m[e]=Math.ceil(Math.max(o,a*(s/1.5))))},n=e.data,a=e.baseCellSize,o=void 0===a?50:a,l=e.fontSize,s=void 0===l?16:l,c=e.showRowNumbers,d=void 0!==c&&c,h=e.showColumnNumbers,u=void 0!==h&&h,x=e.headerFontSize,g=void 0===x?14:x;Array.isArray(n)&&0!==n.length&&Array.isArray(n[0])||(n=[[" "]]);for(var f=n.length,v=n[0].length,m=Array(v).fill(o),p=0;p<v;p++)t(p);var y=m.reduce((function(e,t){return e+t}),0)+(d?o:0),j=(f+(u?1:0))*o;return(0,i.jsxs)("svg",{width:y,height:j,children:[u&&(0,i.jsx)("g",{children:Array.from({length:v},(function(e,t){var n=m.slice(0,t).reduce((function(e,t){return e+t}),d?o:0)+m[t]/2;return(0,i.jsx)("text",{x:n,y:o/2,textAnchor:"middle",dominantBaseline:"central",fontSize:g,fill:"gray",children:t},"col-".concat(t))}))}),d&&(0,i.jsx)("g",{children:Array.from({length:f},(function(e,t){return(0,i.jsx)("text",{x:o/2,y:(t+(u?1:0))*o+o/2,textAnchor:"middle",dominantBaseline:"central",fontSize:g,fill:"gray",children:t},"row-".concat(t))}))}),n.map((function(e,t){return(0,i.jsx)("g",{children:e.map((function(e,n){var r=m.slice(0,n).reduce((function(e,t){return e+t}),d?o:0),a=(t+(u?1:0))*o,l="object"===typeof e?e.value:e,c="object"===typeof e&&e.highlight;return(0,i.jsxs)("g",{children:[(0,i.jsx)("rect",{x:r,y:a,width:m[n],height:o,fill:c?"yellow":"white",stroke:"black"}),(0,i.jsx)("text",{x:r+m[n]/2,y:a+o/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s,children:String(l)})]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))]})});t.default=function(){return(0,i.jsxs)("div",{style:{backgroundColor:"white",padding:"20px"},children:[(0,i.jsx)("h2",{children:"3x3 Matrix:"}),(0,i.jsx)(a,{data:[[1,2,3],[4,{value:5,highlight:!0},6],[7,8,9]],showRowNumbers:!0,showColumnNumbers:!0}),(0,i.jsx)("h2",{children:"4x4 Matrix:"}),(0,i.jsx)(a,{data:[["A","B","C","D"],["E","F",{value:"G",highlight:!0},"H"],["I","J","K","L"],["M","N","O","P"]],showRowNumbers:!0,showColumnNumbers:!0}),(0,i.jsx)("p",{children:"Test with strings"}),(0,i.jsx)(a,{data:[["Oranges","Electronics"],["Oceans","Turtles"]]}),(0,i.jsx)(a,{data:[["ID","Name","Age"],[1,"Alice",25],[2,"Bob",30],[3,"Charlie",35]],showRowNumbers:!1,showColumnNumbers:!1})]})}},93662:function(e,t,n){"use strict";n.r(t),n.d(t,{BinaryTreeDiagram:function(){return o}});var r=n(29815),i=n(85893),a=n(67294),o=function(e){var t=e.root,n=e.nodeRadius,o=void 0===n?20:n,l=e.levelHeight,s=void 0===l?80:l,c=e.fontSize,d=void 0===c?16:c,h=e.width,u=void 0===h?500:h,x=e.height,g=void 0===x?300:x,f=e.horizontalSpacing,v=void 0===f?.2:f,m=function(e){var t=e.node,n=e.x,r=e.y,o=e.radius,l=e.fontSize,s=e.highlight,c=(0,a.useRef)(null),d=(0,a.useState)(0),h=d[0],u=d[1],x=String(t.value);(0,a.useEffect)((function(){c.current&&u(c.current.getBBox().width)}),[x]);var g=Math.max(h+10,2*o),f=2*o;return(0,i.jsxs)("g",{children:[(0,i.jsx)("ellipse",{cx:n,cy:r,rx:g/2,ry:f/2,fill:s?"yellow":"white",stroke:"black"}),(0,i.jsx)("text",{ref:c,x:n,y:r,textAnchor:"middle",dominantBaseline:"central",fontSize:l,children:x})]})},p=function(e){var t=e.x1,n=e.y1,r=e.x2,a=e.y2,o=e.nodeRadius,l=e.textWidth,s=r-t,c=a-n,d=Math.sqrt(s*s+c*c),h=s/d,u=c/d,x=Math.max(l+10,2*o),g=t+h*(x/2),f=n+u*o,v=r-h*(x/2),m=a-u*o;return(0,i.jsx)("line",{x1:g,y1:f,x2:v,y2:m,stroke:"black"})},y=function(e,t,n,a,l,c){if(!e)return{edges:[],nodes:[],textWidth:0};var h=n+s,u={edges:[],nodes:[],textWidth:0},x=(l+c)/2,g=l*(1-v)+x*v,f=c*(1-v)+x*v;if(e.left){var j,w,b=(g+t)/2,S=y(e.left,b,h,a+1,g,t);u.edges.push((0,i.jsx)(p,{x1:t,y1:n,x2:b,y2:h,nodeRadius:o,textWidth:Math.max(u.textWidth,S.textWidth)},"edge-left-".concat(t,"-").concat(n))),(j=u.edges).push.apply(j,(0,r.Z)(S.edges)),(w=u.nodes).push.apply(w,(0,r.Z)(S.nodes)),u.textWidth=Math.max(u.textWidth,S.textWidth)}if(e.right){var k,N,E=(f+t)/2,A=y(e.right,E,h,a+1,t,f);u.edges.push((0,i.jsx)(p,{x1:t,y1:n,x2:E,y2:h,nodeRadius:o,textWidth:Math.max(u.textWidth,A.textWidth)},"edge-right-".concat(t,"-").concat(n))),(k=u.edges).push.apply(k,(0,r.Z)(A.edges)),(N=u.nodes).push.apply(N,(0,r.Z)(A.nodes)),u.textWidth=Math.max(u.textWidth,A.textWidth)}return u.nodes.push((0,i.jsx)(m,{node:e,x:t,y:n,radius:o,fontSize:d,highlight:e.highlight},"node-".concat(t,"-").concat(n))),u}
1,j=y(t,u/2,o+10,0,0,u),w=j.edges,b=j.nodes;return(0,i.jsxs)("svg",{className:"tree-diagram",width:u,height:g,children:[(0,i.jsx)("g",{children:w}),(0,i.jsx)("g",{children:b})]})};t.default=function(){return(0,i.jsxs)("div",{style:{backgroundColor:"white"},children:[(0,i.jsx)("p",{children:"Simple binary tree:"}),(0,i.jsx)(o,{root:{value:1,left:{value:2,highlight:!0},right:{value:3}}}),(0,i.jsx)("p",{children:"Another Tree here:"}),(0,i.jsx)(o,{root:{value:1,left:{value:2,left:{value:4},right:{value:5}},right:{value:3,left:{value:6},right:{value:7},highlight:!0}}}),(0,i.jsx)("p",{children:"Test with strings"}),(0,i.jsx)(o,{root:{value:"Oranges",left:{value:"Ye"},right:{value:"Clouds",highlight:!0}}})]})}},21987:function(e,t,n){"use strict";n.d(t,{Fs:function(){return l},GF:function(){return s},a2:function(){return c},dn:function(){return u},eW:function(){return d},pu:function(){return x}});var r=n(85893),i=n(95801),a=n(85901),o=n(67294),l=function(e,t){var n=(0,o.useState)(!1),r=n[0],i=n[1],a=(0,o.useRef)(null),l=(0,o.useCallback)((function(n){i(!0);var r=new URL(e,window.location.origin);r.searchParams.append("query",n),a.current=new EventSource(r),a.current.onmessage=function(e){var n=JSON.parse(e.data);"[DONE]"===n?(console.log("Stream completed normally"),s()):t(n)},a.current.onerror=function(e){a.current.readyState===EventSource.CLOSED?console.log("EventSource connection closed"):console.error("EventSource failed:",e),s()},a.current.onopen=function(){console.log("EventSource connection opened")}}),[e,t]),s=(0,o.useCallback)((function(){a.current&&a.current.close(),i(!1)}),[]);return(0,o.useEffect)((function(){return function(){a.current&&a.current.close()}}),[]),{isStreaming:r,startStreaming:l,stopStreaming:s}},s=function(e,t){var n=(0,o.useState)(!1),r=n[0],i=n[1],a=(0,o.useRef)(null),l=(0,o.useCallback)((function(n,r,o){i(!0);var l=new URL(e,window.location.origin);l.searchParams.append("problem_id",n),l.searchParams.append("problem_statement",r),l.searchParams.append("knowledge_gaps",o),a.current=new EventSource(l),a.current.onmessage=function(e){var n=JSON.parse(e.data);"[DONE]"===n?(console.log("Stream completed normally"),s()):t(n)},a.current.onerror=function(e){a.current.readyState===EventSource.CLOSED?console.log("EventSource connection closed"):console.error("EventSource failed:",e),s()},a.current.onopen=function(){console.log("EventSource connection opened")}}),[e,t]),s=(0,o.useCallback)((function(){a.current&&a.current.close(),i(!1)}),[]);return(0,o.useEffect)((function(){return function(){a.current&&a.current.close()}}),[]),{isStreaming:r,startBreakdownStreaming:l,stopBreakdownStreaming:s}},c=function(e){var t=e.content,n=e.info,i='\n <style>\n .dcg-overgraph-icon-container { display: none; }\n .dcg-exppanel-outer { display: none !important; }\n .dcg-calculator-api-container .dcg-container.dcg-default-border { border: none !important; }\n </style>\n <script src="https://www.desmos.com/api/v1.5/calculator.js?apiKey=dcb31709b452b1cf9dc26972add0fda6"><\/script>\n <div id="calculator" style="width: 100%; height: 100%px;"></div>\n <script>\n var elt = document.getElementById(\'calculator\');\n var options = {\n expressionsCollapsed: true,\n settingsMenu: false,\n zoomButtons: false,\n lockViewport: true,\n autosize: true,\n showGrid: false,\n };\n var calculator = Desmos.GraphingCalculator(elt, options);\n '.concat(t,"\n <\/script>"),a=encodeURIComponent(i),o="data:text/html;charset=utf-8,".concat(a);return(0,r.jsxs)("div",{className:"flex p-4",children:[(0,r.jsx)("iframe",{src:o,style:{width:"420px",height:"300px"},className:"",title:"Graph Render"}),n&&(0,r.jsx)("div",{className:"ml-4 text-lg flex items-center max-w-xs",children:n})]})},d=function(e){var t=e.expressions,n=e.info,i='\n <style>\n .dcg-overgraph-icon-container { display: none; }\n .dcg-exppanel-outer { display: none !important; }\n .dcg-calculator-api-container .dcg-container.dcg-default-border { border: none !important; }\n\n .dcg-container { border-radius: 10px; }\n\n </style>\n <script src="https://www.desmos.com/api/v1.5/calculator.js?apiKey=dcb31709b452b1cf9dc26972add0fda6"><\/script>\n <div id="calculator" style="width: 100%; height: 100%px;"></div>\n <script>\n var elt = document.getElementById(\'calculator\');\n var options = {\n expressionsCollapsed: true,\n settingsMenu: false,\n zoomButtons: true,\n lockViewport: false,\n autosize: true,\n showGrid: false,\n };\n var calculator = Desmos.GraphingCalculator(elt, options);\n \n const expressions = '.concat(JSON.stringify(t),";\n expressions.forEach(expr => {\n calculator.setExpression(expr);\n });\n <\/script>"),a=encodeURIComponent(i),o="data:text/html;charset=utf-8,".concat(a);return(0,r.jsxs)("div",{className:"flex flex-col md:flex-row p-4",children:[(0,r.jsx)("iframe",{src:o,style:{width:"100%",maxWidth:"420px",height:"300px"},className:"mx-auto",title:"Graph Render"}),n&&(0,r.jsx)("div",{className:"mt-4 md:mt-0 md:ml-4 text-lg flex items-center max-w-xs mx-auto md:mx-0",children:n})]})},h={python3:"python","c++":"cpp","c#":"csharp"},u=function(e){var t=e.code,n=e.lang,o=void 0===n?"plain":n,l=h[o.toLowerCase()]||o;return(0,r.jsx)(i.Z,{language:l,style:a.default,className:"codeBlock",lineNumberStyle:{color:"#888",minWidth:"2em",paddingRight:"10px"},customStyle:{width:"fit-content"},children:t.trim()})},x={Colors:{RED:"#c74440",BLUE:"#2d70b3",GREEN:"#388c46",PURPLE:"#6042a6",ORANGE:"#fa7e19",BLACK:"#000000"},Styles:{POINT:"point",OPEN:"open",CROSS:"cross",SOLID:"solid",DASHED:"dashed",DOTTED:"dotted"}}}},function(e){e.O(0,[8889,573,5801,2534,626,9774,2888,179],(function(){return t=96186,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.