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

Reputation: 203 Stalwart
Group:
Active Members
Active Posts:
1,713 (0.76 per day)
Joined:
13-March 10
Profile Views:
51,112
Last Active:
User is offline Apr 28 2016 08:47 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   darek9576 has not set their status

Posts I've Made

  1. In Topic: Removing elements from vector

    Posted 4 Apr 2016

    Maybe something along those lines will help you:

    
    if(inputtwo == 2){
            std::string courseName = "Mathematics";
            for(auto it = std::begin(studentstructures); it != std::end(studentstructures);)/>{
                  auto it2 = std::find_if(std::begin(it->coursetrack), std::end(it->coursetrack), [courseName](const Course & c){
                        return c.coursename == courseName;
                  }
    
                  if(it2 != std::end(it->coursetrack){
                        it = studentstructures.erase(it);
                  }else ++it;
    
            }
    
    }
    
    
    
  2. In Topic: Struggling with *& pointer and getting next pointer.

    Posted 2 Jan 2016

    Thanks. I will give a pointer to pointer a go.
  3. 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.
  4. 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
    	}
    }
    
  5. 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?

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?