SlideShare a Scribd company logo
1 of 5
Download to read offline
Extend your work on the OCC logo to add shapes that 'curve1 the blue Cs into looking
something more like the actual logo:
Solution
import java.awt.Color;
import java.util.Comparator;
/**
* a straightforward red-black tree category.
*/
public category RedBlackTree extends BinarySearchTree Associate in Nursing empty
RedBlackTree which will solely settle for Comparables as
* items.
*/
public RedBlackTree()
/**
* Constructs Associate in Nursing empty RedBlackTree that orders its things in keeping with
the
* given comparator.
*/
public RedBlackTree(Comparator c)
/**
* The nodes during a red-black tree store a color beside the particular information
* within the node.
*/
category Node extends LinkedBinaryTreeNode
}
/**
* Adds one information item to the tree. If there's already Associate in Nursing item within the
* tree that compares up to the item being inserted, it's "overwritten"
* by the new item. Overrides BinarySearchTree.add as a result of the tree must
* be adjusted when insertion.
*/
public void add(Object data)
BinaryTreeNode n = root;
whereas (true) else if (comparisonResult < 0)
n = n.getLeft();
} else zero
if (n.getRight() == null)
n = n.getRight();
}
}
}
/**
* Removes the node containing the given price. will nothing if there's no
* such node.
*/
public void remove(Object data) else if (node.getLeft() != null && node.getRight() != null) 2
kids, Copy forerunner information in.
BinaryTreeNode forerunner = predecessor(node);
node.setData(predecessor.getData());
node = (Node) predecessor;
}
// At this time node has zero or one kid
Node pullUp = leftOf(node) == null ? rightOf(node) : leftOf(node);
if (pullUp != null) regulate if pullUp could be a double black.
if (node == root) else if (node.getParent().getLeft() == node) else
if (isBlack(node))
} else if (node == root) to drag up once deleting a root means that we have a tendency to empty
the tree
setRoot(null);
} else lookout
if (isBlack(node))
node.removeFromParent();
}
}
/**
* Classic formula for fixing up a tree when inserting a node.
*/
personal void adjustAfterInsertion(Node n) issues, if they exist
if (n != null && n != root && isRed(parentOf(n))) to ascertain if additional work
// needed
if (isRed(siblingOf(parentOf(n))))
// Step 2b: reconstitute for a parent United Nations agency is that the left kid of the
// forebear. this may need one right rotation if n is
// also
// a left kid, or a left-right rotation otherwise.
else if (parentOf(n) == leftOf(grandparentOf(n)))
setColor(parentOf(n), Color.black);
setColor(grandparentOf(n), Color.red);
rotateRight(grandparentOf(n));
}
// Step 2c: reconstitute for a parent United Nations agency is that the right kid of the
// forebear. this may need one left rotation if n is
// also
// a right kid, or a right-left rotation otherwise.
else if (parentOf(n) == rightOf(grandparentOf(n)))
setColor(parentOf(n), Color.black);
setColor(grandparentOf(n), Color.red);
rotateLeft(grandparentOf(n));
}
}
// Step 3: Color the foundation black
setColor((Node) root, Color.black);
}
/**
* Classic formula for fixing up a tree when removing a node; the
* parameter to the present technique is that the node that was force up to wherever the
* removed node was.
*/
personal void adjustAfterRemoval(Node n) {
whereas (n != root && isBlack(n)) {
if (n == leftOf(parentOf(n))) {
// force up node could be a left kid
Node relative = rightOf(parentOf(n));
if (isRed(sibling)) {
setColor(sibling, Color.black);
setColor(parentOf(n), Color.red);
rotateLeft(parentOf(n));
relative = rightOf(parentOf(n));
}
if (isBlack(leftOf(sibling)) && isBlack(rightOf(sibling))) else {
if (isBlack(rightOf(sibling))) {
setColor(leftOf(sibling), Color.black);
setColor(sibling, Color.red);
rotateRight(sibling);
relative = rightOf(parentOf(n));
}
setColor(sibling, colorOf(parentOf(n)));
setColor(parentOf(n), Color.black);
setColor(rightOf(sibling), Color.black);
rotateLeft(parentOf(n));
n = (Node) root;
}
} else {
// force up node could be a right kid
Node relative = leftOf(parentOf(n));
if (isRed(sibling)) {
setColor(sibling, Color.black);
setColor(parentOf(n), Color.red);
rotateRight(parentOf(n));
relative = leftOf(parentOf(n));
}
if (isBlack(leftOf(sibling)) && isBlack(rightOf(sibling))) else {
if (isBlack(leftOf(sibling))) {
setColor(rightOf(sibling), Color.black);
setColor(sibling, Color.red);
rotateLeft(sibling);
relative = leftOf(parentOf(n));
}
setColor(sibling, colorOf(parentOf(n)));
setColor(parentOf(n), Color.black);
setColor(leftOf(sibling), Color.black);
rotateRight(parentOf(n));
n = (Node) root;
}
}
}
setColor(n, Color.black);
}
// the subsequent helpers dramatically modify the code by obtaining
// all the null pointer sorting out of the adjustment strategies.
personal Color colorOf(Node n) come back n == null ? Color.black : n.color;
}
personal mathematician isRed(Node n) come back n != null && colorOf(n) == Color.red;
}
personal mathematician isBlack(Node n) come back n == null || colorOf(n) == Color.black;
}
personal void setColor(Node n, Color c)
personal Node parentOf(Node n) come back n == null ? null : (Node) n.getParent();
}
personal Node grandparentOf(Node n) come back (n == null || n.getParent() == null) ? null :
(Node) n
.getParent().getParent();
}
personal Node siblingOf(Node n) come back (n == null || n.getParent() == null) ? null : (n == n
.getParent().getLeft()) ? (Node) n.getParent().getRight()
: (Node) n.getParent().getLeft();
}
personal Node leftOf(Node n) come back n == null ? null : (Node) n.getLeft();
}
personal Node rightOf(Node n) come back n == null ? null : (Node) n.getRight();
}
}

More Related Content

Similar to Extend your work on the OCC logo to add shapes that curve1 the blue.pdf

Hello- the following code- In LeftRotaate and RightRotate methods for.pdf
Hello- the following code- In LeftRotaate and RightRotate methods for.pdfHello- the following code- In LeftRotaate and RightRotate methods for.pdf
Hello- the following code- In LeftRotaate and RightRotate methods for.pdf
a2zmobiles
 
Modify this code to do an Insert function for an AVL tree, instead o.pdf
Modify this code to do an Insert function for an AVL tree, instead o.pdfModify this code to do an Insert function for an AVL tree, instead o.pdf
Modify this code to do an Insert function for an AVL tree, instead o.pdf
fathimaoptical
 
Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdf
archiesgallery
 
There is BinarySearchTree class. When removing a node from a BST, we.pdf
There is BinarySearchTree class. When removing a node from a BST, we.pdfThere is BinarySearchTree class. When removing a node from a BST, we.pdf
There is BinarySearchTree class. When removing a node from a BST, we.pdf
Dhanrajsolanki2091
 
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdfmain.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
pratikradia365
 
Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdf
ajaycosmeticslg
 
Given a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdfGiven a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdf
hadpadrrajeshh
 
A perfect left-sided binary tree is a binary tree where every intern.pdf
A perfect left-sided binary tree is a binary tree where every intern.pdfA perfect left-sided binary tree is a binary tree where every intern.pdf
A perfect left-sided binary tree is a binary tree where every intern.pdf
michardsonkhaicarr37
 
Please write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdfPlease write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdf
amarndsons
 
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.pptUnit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Sheba41
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
illyasraja7
 

Similar to Extend your work on the OCC logo to add shapes that curve1 the blue.pdf (20)

Trees
TreesTrees
Trees
 
Hello- the following code- In LeftRotaate and RightRotate methods for.pdf
Hello- the following code- In LeftRotaate and RightRotate methods for.pdfHello- the following code- In LeftRotaate and RightRotate methods for.pdf
Hello- the following code- In LeftRotaate and RightRotate methods for.pdf
 
Lecture10
Lecture10Lecture10
Lecture10
 
Modify this code to do an Insert function for an AVL tree, instead o.pdf
Modify this code to do an Insert function for an AVL tree, instead o.pdfModify this code to do an Insert function for an AVL tree, instead o.pdf
Modify this code to do an Insert function for an AVL tree, instead o.pdf
 
Write a program that displays an AVL tree along with its balance fact.docx
 Write a program that displays an AVL tree along with its balance fact.docx Write a program that displays an AVL tree along with its balance fact.docx
Write a program that displays an AVL tree along with its balance fact.docx
 
Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdf
 
There is BinarySearchTree class. When removing a node from a BST, we.pdf
There is BinarySearchTree class. When removing a node from a BST, we.pdfThere is BinarySearchTree class. When removing a node from a BST, we.pdf
There is BinarySearchTree class. When removing a node from a BST, we.pdf
 
Biary search Tree.docx
Biary search Tree.docxBiary search Tree.docx
Biary search Tree.docx
 
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdfmain.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
main.cpp#include TreeNode.h GIVEN void inorderTraversal(.pdf
 
Binary trees
Binary treesBinary trees
Binary trees
 
Trees in data structrures
Trees in data structruresTrees in data structrures
Trees in data structrures
 
Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdf
 
#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docx#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docx
 
Given a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdfGiven a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdf
 
A perfect left-sided binary tree is a binary tree where every intern.pdf
A perfect left-sided binary tree is a binary tree where every intern.pdfA perfect left-sided binary tree is a binary tree where every intern.pdf
A perfect left-sided binary tree is a binary tree where every intern.pdf
 
Please write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdfPlease write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdf
 
Using the following definition for a Binary Tree Node - complete the f.docx
Using the following definition for a Binary Tree Node - complete the f.docxUsing the following definition for a Binary Tree Node - complete the f.docx
Using the following definition for a Binary Tree Node - complete the f.docx
 
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.pptUnit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
 
Data Structures
Data StructuresData Structures
Data Structures
 

More from arihantcommunication

A concerned mother brings her 2-year-old daughter to the clinic with.pdf
A concerned mother brings her 2-year-old daughter to the clinic with.pdfA concerned mother brings her 2-year-old daughter to the clinic with.pdf
A concerned mother brings her 2-year-old daughter to the clinic with.pdf
arihantcommunication
 
A study compared 4 groups with 6 observations per group. An statisti.pdf
A study compared 4 groups with 6 observations per group. An statisti.pdfA study compared 4 groups with 6 observations per group. An statisti.pdf
A study compared 4 groups with 6 observations per group. An statisti.pdf
arihantcommunication
 
Write a one-page statement showing that you have A knowledge of cur.pdf
Write a one-page statement showing that you have A knowledge of cur.pdfWrite a one-page statement showing that you have A knowledge of cur.pdf
Write a one-page statement showing that you have A knowledge of cur.pdf
arihantcommunication
 
What is the role of RFID chips in logistics What is the role o.pdf
What is the role of RFID chips in logistics What is the role o.pdfWhat is the role of RFID chips in logistics What is the role o.pdf
What is the role of RFID chips in logistics What is the role o.pdf
arihantcommunication
 
tut all words or phases will be inca. cach likathawnb tha bat wer.pdf
tut all words or phases will be inca. cach likathawnb tha bat wer.pdftut all words or phases will be inca. cach likathawnb tha bat wer.pdf
tut all words or phases will be inca. cach likathawnb tha bat wer.pdf
arihantcommunication
 
Theories of law enforcementSubjectDiscuss the positive and negati.pdf
Theories of law enforcementSubjectDiscuss the positive and negati.pdfTheories of law enforcementSubjectDiscuss the positive and negati.pdf
Theories of law enforcementSubjectDiscuss the positive and negati.pdf
arihantcommunication
 
Please make a comment for all the codesOr explain this pro.pdf
Please make a comment for all the codesOr explain this pro.pdfPlease make a comment for all the codesOr explain this pro.pdf
Please make a comment for all the codesOr explain this pro.pdf
arihantcommunication
 
1.In which case(s) is there constructive interference for two ligh.pdf
1.In which case(s) is there constructive interference for two ligh.pdf1.In which case(s) is there constructive interference for two ligh.pdf
1.In which case(s) is there constructive interference for two ligh.pdf
arihantcommunication
 

More from arihantcommunication (20)

C++Write a function bool isLevel(int a, int n) which determines i.pdf
C++Write a function bool isLevel(int a, int n) which determines i.pdfC++Write a function bool isLevel(int a, int n) which determines i.pdf
C++Write a function bool isLevel(int a, int n) which determines i.pdf
 
Arsenic is implanted into a lightly doped p-type Si substrate at an e.pdf
Arsenic is implanted into a lightly doped p-type Si substrate at an e.pdfArsenic is implanted into a lightly doped p-type Si substrate at an e.pdf
Arsenic is implanted into a lightly doped p-type Si substrate at an e.pdf
 
According to Mendels Law of Segregation which of the following is s.pdf
According to Mendels Law of Segregation which of the following is s.pdfAccording to Mendels Law of Segregation which of the following is s.pdf
According to Mendels Law of Segregation which of the following is s.pdf
 
A concerned mother brings her 2-year-old daughter to the clinic with.pdf
A concerned mother brings her 2-year-old daughter to the clinic with.pdfA concerned mother brings her 2-year-old daughter to the clinic with.pdf
A concerned mother brings her 2-year-old daughter to the clinic with.pdf
 
A study compared 4 groups with 6 observations per group. An statisti.pdf
A study compared 4 groups with 6 observations per group. An statisti.pdfA study compared 4 groups with 6 observations per group. An statisti.pdf
A study compared 4 groups with 6 observations per group. An statisti.pdf
 
Why is it important that chromosomes can cross over in Meiosis and n.pdf
Why is it important that chromosomes can cross over in Meiosis and n.pdfWhy is it important that chromosomes can cross over in Meiosis and n.pdf
Why is it important that chromosomes can cross over in Meiosis and n.pdf
 
Write a one-page statement showing that you have A knowledge of cur.pdf
Write a one-page statement showing that you have A knowledge of cur.pdfWrite a one-page statement showing that you have A knowledge of cur.pdf
Write a one-page statement showing that you have A knowledge of cur.pdf
 
Which of the following is the purpose of valves in the venous circul.pdf
Which of the following is the purpose of valves in the venous circul.pdfWhich of the following is the purpose of valves in the venous circul.pdf
Which of the following is the purpose of valves in the venous circul.pdf
 
When society makes a particular good or service illegal is it making.pdf
When society makes a particular good or service illegal is it making.pdfWhen society makes a particular good or service illegal is it making.pdf
When society makes a particular good or service illegal is it making.pdf
 
Which physical topology has all systems connecting to a central conn.pdf
Which physical topology has all systems connecting to a central conn.pdfWhich physical topology has all systems connecting to a central conn.pdf
Which physical topology has all systems connecting to a central conn.pdf
 
What is the role of RFID chips in logistics What is the role o.pdf
What is the role of RFID chips in logistics What is the role o.pdfWhat is the role of RFID chips in logistics What is the role o.pdf
What is the role of RFID chips in logistics What is the role o.pdf
 
tut all words or phases will be inca. cach likathawnb tha bat wer.pdf
tut all words or phases will be inca. cach likathawnb tha bat wer.pdftut all words or phases will be inca. cach likathawnb tha bat wer.pdf
tut all words or phases will be inca. cach likathawnb tha bat wer.pdf
 
Theories of law enforcementSubjectDiscuss the positive and negati.pdf
Theories of law enforcementSubjectDiscuss the positive and negati.pdfTheories of law enforcementSubjectDiscuss the positive and negati.pdf
Theories of law enforcementSubjectDiscuss the positive and negati.pdf
 
What does a blower door doSolutionA blower door is a device w.pdf
What does a blower door doSolutionA blower door is a device w.pdfWhat does a blower door doSolutionA blower door is a device w.pdf
What does a blower door doSolutionA blower door is a device w.pdf
 
The US population in millions is P(t) today, where time t is measured.pdf
The US population in millions is P(t) today, where time t is measured.pdfThe US population in millions is P(t) today, where time t is measured.pdf
The US population in millions is P(t) today, where time t is measured.pdf
 
Please make a comment for all the codesOr explain this pro.pdf
Please make a comment for all the codesOr explain this pro.pdfPlease make a comment for all the codesOr explain this pro.pdf
Please make a comment for all the codesOr explain this pro.pdf
 
The purpose of a database is to. Select one store lists of data invo.pdf
The purpose of a database is to. Select one store lists of data invo.pdfThe purpose of a database is to. Select one store lists of data invo.pdf
The purpose of a database is to. Select one store lists of data invo.pdf
 
Stadents version-p. 2 0. (Table 3) item(s) at the deli bar causing .pdf
Stadents version-p. 2 0. (Table 3) item(s) at the deli bar causing .pdfStadents version-p. 2 0. (Table 3) item(s) at the deli bar causing .pdf
Stadents version-p. 2 0. (Table 3) item(s) at the deli bar causing .pdf
 
A major hurricane is a hurricane with wind speeds of 111 miles per h.pdf
A major hurricane is a hurricane with wind speeds of 111 miles per h.pdfA major hurricane is a hurricane with wind speeds of 111 miles per h.pdf
A major hurricane is a hurricane with wind speeds of 111 miles per h.pdf
 
1.In which case(s) is there constructive interference for two ligh.pdf
1.In which case(s) is there constructive interference for two ligh.pdf1.In which case(s) is there constructive interference for two ligh.pdf
1.In which case(s) is there constructive interference for two ligh.pdf
 

Recently uploaded

SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Recently uploaded (20)

SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 

Extend your work on the OCC logo to add shapes that curve1 the blue.pdf

  • 1. Extend your work on the OCC logo to add shapes that 'curve1 the blue Cs into looking something more like the actual logo: Solution import java.awt.Color; import java.util.Comparator; /** * a straightforward red-black tree category. */ public category RedBlackTree extends BinarySearchTree Associate in Nursing empty RedBlackTree which will solely settle for Comparables as * items. */ public RedBlackTree() /** * Constructs Associate in Nursing empty RedBlackTree that orders its things in keeping with the * given comparator. */ public RedBlackTree(Comparator c) /** * The nodes during a red-black tree store a color beside the particular information * within the node. */ category Node extends LinkedBinaryTreeNode } /** * Adds one information item to the tree. If there's already Associate in Nursing item within the * tree that compares up to the item being inserted, it's "overwritten" * by the new item. Overrides BinarySearchTree.add as a result of the tree must * be adjusted when insertion. */ public void add(Object data) BinaryTreeNode n = root; whereas (true) else if (comparisonResult < 0)
  • 2. n = n.getLeft(); } else zero if (n.getRight() == null) n = n.getRight(); } } } /** * Removes the node containing the given price. will nothing if there's no * such node. */ public void remove(Object data) else if (node.getLeft() != null && node.getRight() != null) 2 kids, Copy forerunner information in. BinaryTreeNode forerunner = predecessor(node); node.setData(predecessor.getData()); node = (Node) predecessor; } // At this time node has zero or one kid Node pullUp = leftOf(node) == null ? rightOf(node) : leftOf(node); if (pullUp != null) regulate if pullUp could be a double black. if (node == root) else if (node.getParent().getLeft() == node) else if (isBlack(node)) } else if (node == root) to drag up once deleting a root means that we have a tendency to empty the tree setRoot(null); } else lookout if (isBlack(node)) node.removeFromParent(); } } /** * Classic formula for fixing up a tree when inserting a node. */ personal void adjustAfterInsertion(Node n) issues, if they exist if (n != null && n != root && isRed(parentOf(n))) to ascertain if additional work // needed
  • 3. if (isRed(siblingOf(parentOf(n)))) // Step 2b: reconstitute for a parent United Nations agency is that the left kid of the // forebear. this may need one right rotation if n is // also // a left kid, or a left-right rotation otherwise. else if (parentOf(n) == leftOf(grandparentOf(n))) setColor(parentOf(n), Color.black); setColor(grandparentOf(n), Color.red); rotateRight(grandparentOf(n)); } // Step 2c: reconstitute for a parent United Nations agency is that the right kid of the // forebear. this may need one left rotation if n is // also // a right kid, or a right-left rotation otherwise. else if (parentOf(n) == rightOf(grandparentOf(n))) setColor(parentOf(n), Color.black); setColor(grandparentOf(n), Color.red); rotateLeft(grandparentOf(n)); } } // Step 3: Color the foundation black setColor((Node) root, Color.black); } /** * Classic formula for fixing up a tree when removing a node; the * parameter to the present technique is that the node that was force up to wherever the * removed node was. */ personal void adjustAfterRemoval(Node n) { whereas (n != root && isBlack(n)) { if (n == leftOf(parentOf(n))) { // force up node could be a left kid Node relative = rightOf(parentOf(n)); if (isRed(sibling)) { setColor(sibling, Color.black); setColor(parentOf(n), Color.red);
  • 4. rotateLeft(parentOf(n)); relative = rightOf(parentOf(n)); } if (isBlack(leftOf(sibling)) && isBlack(rightOf(sibling))) else { if (isBlack(rightOf(sibling))) { setColor(leftOf(sibling), Color.black); setColor(sibling, Color.red); rotateRight(sibling); relative = rightOf(parentOf(n)); } setColor(sibling, colorOf(parentOf(n))); setColor(parentOf(n), Color.black); setColor(rightOf(sibling), Color.black); rotateLeft(parentOf(n)); n = (Node) root; } } else { // force up node could be a right kid Node relative = leftOf(parentOf(n)); if (isRed(sibling)) { setColor(sibling, Color.black); setColor(parentOf(n), Color.red); rotateRight(parentOf(n)); relative = leftOf(parentOf(n)); } if (isBlack(leftOf(sibling)) && isBlack(rightOf(sibling))) else { if (isBlack(leftOf(sibling))) { setColor(rightOf(sibling), Color.black); setColor(sibling, Color.red); rotateLeft(sibling); relative = leftOf(parentOf(n)); } setColor(sibling, colorOf(parentOf(n))); setColor(parentOf(n), Color.black); setColor(leftOf(sibling), Color.black); rotateRight(parentOf(n));
  • 5. n = (Node) root; } } } setColor(n, Color.black); } // the subsequent helpers dramatically modify the code by obtaining // all the null pointer sorting out of the adjustment strategies. personal Color colorOf(Node n) come back n == null ? Color.black : n.color; } personal mathematician isRed(Node n) come back n != null && colorOf(n) == Color.red; } personal mathematician isBlack(Node n) come back n == null || colorOf(n) == Color.black; } personal void setColor(Node n, Color c) personal Node parentOf(Node n) come back n == null ? null : (Node) n.getParent(); } personal Node grandparentOf(Node n) come back (n == null || n.getParent() == null) ? null : (Node) n .getParent().getParent(); } personal Node siblingOf(Node n) come back (n == null || n.getParent() == null) ? null : (n == n .getParent().getLeft()) ? (Node) n.getParent().getRight() : (Node) n.getParent().getLeft(); } personal Node leftOf(Node n) come back n == null ? null : (Node) n.getLeft(); } personal Node rightOf(Node n) come back n == null ? null : (Node) n.getRight(); } }