Skip to content

Instantly share code, notes, and snippets.

@Arkango
Arkango / ShallowCopy.java
Created June 8, 2019 07:18
In the above example, ‘student1‘ is an object of ‘Student‘ class which has three fields – id, name and course. ‘course‘ is a reference variable pointing to a ‘Course‘ type object. Clone of ‘student1‘ is created by calling clone method on it and assigned it to ‘student2‘. As default version of clone method creates the shallow copy, the ‘course‘ f…
class Course
{
String subject1;
String subject2;
String subject3;
public Course(String sub1, String sub2, String sub3)
{
@Arkango
Arkango / main.cpp
Created November 24, 2018 18:20
levelvisit binarytree
template < typename F>
void visitaPerLivelli(BinaryTree<F>* t){
codePointer<F> C;
C.incoda(t->key());
while(!C.codavuota()){
F nodo = C.leggicoda();
C.fuoricoda();
BinaryTree<F>* nodoAlbero = t->lookupNode(nodo);
cout << nodoAlbero->key() << "\n";