darek9576's Profile User Rating: ***--

Reputation: 203 Stalwart
Group:
Active Members
Active Posts:
1,711 (0.79 per day)
Joined:
13-March 10
Profile Views:
50,389
Last Active:
User is offline Jan 15 2016 10:47 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   darek9576 has not set their status

Posts I've Made

  1. In Topic: Struggling with *& pointer and getting next pointer.

    Posted 2 Jan 2016

    Thanks. I will give a pointer to pointer a go.
  2. In Topic: Struggling with *& pointer and getting next pointer.

    Posted 29 Dec 2015

    Yes, exactly - a reference to the pointer to the node to be deleted. I am just wondering if it's possible to replicate the recursive code in an iterative manner. As we know references, cannot be reassigned what makes me wonder it it's feasible.
  3. In Topic: Struggling with *& pointer and getting next pointer.

    Posted 29 Dec 2015

    I had the code you have above written before. In short, it seems that i need to query again to check if i am interested in right or left link. Is it necessary though? In the code i posted at the very top (code i have found online) they dont do it.
    template<typename T>
    void BST<T>::remove(const T& value){
    	remove(value, _root);
    }
    
    template<typename T>
    void BST<T>::remove(const T& value, Node<T>* current) {
    	Node<T>* previous = nullptr;
    	while (current && current->getValue() != value){
    		previous = current;
    		if (value <= current->getValue()){ current = current->getLeft(); }
    		else{ current = current->getRight(); }
    	}
    
    	if (previous){
    		//previous points to something
    		//now i need to get the link from previous to current
    		//lets assume current in not null
    		//i need to AGAIN query for if(value <= current->getValue()) to see which link i am interested in (right one or left one)
    		//or is there a way to get it without this if statements
    	}
    }
    
  4. In Topic: Struggling with *& pointer and getting next pointer.

    Posted 29 Dec 2015

    Ok, thanks for the reply but i have already tried that with no lack. The issue im facing is that i do not want the pointer to the node, i want to have the actual pointer of a parent node that i want to delete.
    Is it still possible?
  5. In Topic: Deque implementation using array

    Posted 6 Oct 2015

    Hey,

    I will be talking from a C++'s point of view but i think the same logic will apply to Java. C++ has a built in data structure std::deque which is a double ended queue. It is usually implemented as a vector of vectors. Essentially, the first (main) vector holds pointers to other vectors that we can call chunks or pages. Those pages must be the same size. This structure allows you to add at the front and back in amortized constant time. Adding in the middle, will have up to N/2 shifts. You essentially will need to work out whether you are closer to the end or front of the deque and shift the items accordingly in that direction.

    Coming back to your question. You have to use an array so as above i mentioned that C++ implements it as vector of vectors, you will use array of arrays.

    (I am not sure if you can implement a deque using a circular array)

    Hope it makes sense.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

darek9576 hasn't added any friends yet.

Comments

darek9576 has no profile comments yet. Why not say hello?