This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BTLeavesToDLL { | |
| public static TNode<Integer> getLeaves(TNode<Integer> root){ | |
| if(root==null){ | |
| return null; | |
| } | |
| if(isLeaf(root)){ | |
| return root; | |
| } | |
| else{ | |
| TNode<Integer> left=getLeaves(root.left); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class IsSameBST { | |
| public static boolean calculate(int []a, int []b){ | |
| return calculateRecursive(a, b, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE); | |
| } | |
| private static boolean calculateRecursive(int []a,int []b, int i_a, int j_b, int min, int max){ | |
| int i; | |
| int j; | |
| for(i=i_a;i<a.length;i++) | |
| if(a[i]>min && a[i]<max) break; | |
| for(j=j_b;j<b.length;j++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdlib.h> | |
| #include<stdio.h> | |
| struct node{ | |
| struct node *left; | |
| struct node *right; | |
| int v; | |
| }; | |
| struct node *root; | |
| void add_left(struct node *r,int v){ | |
| if(r){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TreeTraversal { | |
| public static void inOrderWithoutRecursion(TNode<Integer> parent){ | |
| TNode<Integer> current= parent; | |
| Stack<TNode<Integer>> stack =new Stack<TNode<Integer>>(); | |
| while(true){ | |
| if(current.left!=null){ | |
| stack.push(current); | |
| current=current.left; | |
| } | |
| else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Web.Http; | |
| namespace Skeleton.WebAPI.Controllers | |
| { | |
| // [Authorize] | |
| public class ValuesController : ApiController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax({ | |
| type: "GET", | |
| url: 'http://localhost:port/api/values', | |
| success: function (_d) { alert(JSON.stringify(_d));} | |
| }).fail(function (_d) { alert(JSON.stringify(_d)); }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void Register(HttpConfiguration config) | |
| { | |
| config.EnableCors(); | |
| // other stuff | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [EnableCors(origins: "*", headers: "*", methods: "*")] | |
| // [Authorize] | |
| public class ValuesController : ApiController { /*Class Definition*/} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RouteConfig.RegisterRoutes(RouteTable.Routes); | |
| BundleConfig.RegisterBundles(BundleTable.Bundles); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [EnableCors(origins: "*", headers: "*", methods: "*")] |