Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Stack<Item> AppearencesOtef (BinTreeNode <Integer> T, Stack<Integer> S)
- {
- Stack <Integer> helper = copyStack(S);
- Stack <Integer> btn= copyBinTreeIntoStack(T);
- return (Appearences(helper,btn))
- }
- public static Stack<Item> Appearences(Stack<Integer> helper,Stack <Integer> btn)
- {
- Stack<Item> Sitm= null;
- while (!helper.isEmpty() )
- {
- int x=helper.top();
- int Scount=CountAppeirence(x,helper);
- int BTNcount=CountAppeirence(x,btn);
- Item itm = new Item (helper.pop(),Scount,BTNcount);
- DeleteX(x,helper);
- DeleteX(x,btn);
- Sitm.push(itm);
- }
- while (!btn.isEmpty() )
- {
- int x=btn.top();
- int BTNcount=CountAppeirence(x,btn);
- Item itm = new Item (btn.pop(),0, BTNcount);
- Sitm.push(itm);
- }
- return Sitm;
- }
Advertisement
Add Comment
Please, Sign In to add comment