MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / insert

Function insert

HackerEarth_problems/Subarrays XOR/Solution.cpp:59–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 int countr=0;
58};
59void insert(int n,trienode* head)
60{
61 trienode* curr=head;
62 for(int i=20;i>=0;i--)
63 {
64 int b=(n>>i)&1;
65 if(b==0)
66 {
67 curr->countl++;
68 if(!curr->left){
69 curr->left=new trienode;
70 }
71 curr=curr->left;
72 }
73 else
74 {
75 curr->countr++;
76 if(!curr->right){
77 curr->right=new trienode;
78 }
79 curr=curr->right;
80 }
81 //cout<<"curr-left: "<<curr->countl<<" curr-right: "<<curr->countr<<endl;
82 }
83}
84
85int find_max_xor(trienode* head,int val,int k)
86{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected