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

Reputation: 203 Stalwart
Active Members
Active Posts:
1,706 (0.82 per day)
13-March 10
Profile Views:
Last Active:
User is offline Nov 13 2015 09:29 AM

Previous Fields

Dream Kudos:
Icon   darek9576 has not set their status

Posts I've Made

  1. In Topic: Deque implementation using array

    Posted 6 Oct 2015


    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.
  2. In Topic: std::deque confusion

    Posted 28 Sep 2015

    Thanks. I have changed the optimization settings and i am getting the results that look more or less like yours.
  3. In Topic: std::deque confusion

    Posted 27 Sep 2015

    Not sure if we have the same settings, but this is my output:

    Vector took: 8758 milliseconds.
    Deque (double ended queue) took: 47196 milliseconds.

    Can i change somehow my settings to match your output.
  4. In Topic: When object variables "overwrite" eachother

    Posted 24 Aug 2015

    You might check out static members. Instance variables will always be specific to an object.
  5. In Topic: missing template arguments before

    Posted 23 Aug 2015

    This does not answer your question, but if you have access to Boost libraries, you could use boost::algorithm::to_upper() or boost::algorithm::to_upper_copy() functions as the following:

    #include <vector>
    #include <boost/algorithm/string.hpp>
    void boostExample(){
    	std::vector<std::string> words = { "this", "is", "a", "lower", "case", "sentence" };
    	std::for_each(std::begin(words), std::end(words), [](const std::string & e) { 
    		std::cout << boost::algorithm::to_upper_copy(e) << " "; }

My Information

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

Contact Information

Click here to e-mail me


darek9576 hasn't added any friends yet.


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