Rather than proposing a fancy sorting algorithm, I'd suggest reviewing the Quine-McKlusky algotithm. If every boolean equation (or those with about 12 inputs) required sorting 8 million entries then it would take forever to compile hdl code. I wrote a Q-M routine in Pascal about 15 years ago and I don't recall having to do this. It was so damned long ago that the only thing I can remember about it were that I nearly went insane implement my first recursive program. recursion - n. See the definition of recursion. When you generate your mappings of your terms, try looking for a clever way of ordering the data. It may save you a little time... Scott On Wed, 23 Aug 2000, Samuel Winchenbach wrote: > >Could you better explain what you are trying to do. Would the number > >00001111 come before 00011110, or when there is the same number of ones > >is there a secondary sort to bring the binary implementation into > >play? > > *SNIP* > > Thanks for the response. > > 0000 > 0001 > 0010 > 0011 > 0100 > 0101 > 0110 > 0111 > 1000 > 1001 > 1010 > 1011 > 1100 > 1101 > 1110 > 1111 > > would be sorted to: > > 0000 > > 0001 > 0010 > 0100 > 1000 > > 0011 > 0101 > 0110 > 1001 > 1010 > 1100 > > 0111 > 1011 > 1101 > 1110 > > 1111 > > > As you can see the numbers are sorted by the number of one's in the binary > representation. The actual value has nothing to do with it. So what I > have done is the following: > > > class quine > { > private: > > public: > int value; > int blanks; > > bool operator > (quine &rightside) const; > bool operator >= (quine &rightside) const; > bool operator < (quine &rightside) const; > bool operator <= (quine &rightside) const; > bool operator == (quine &rightside) const; > }; > > value is the actual number (NOT the number of ones in the binary > representaion) > > next I store all 8 million numbers in a vector of quine: > > vector mterms; //minterms > > for( blah blah.. ) > { > //cycle throught the text file, and push a type "quine" into the vector > //after setting its value. > } > > now the next thing I want to do is sort my vector of type quine. not by > value, but by the number of one's in the binary representation of value. > > I already have this working using selection sort.... but by god, I think I > would grow old and die before it finished. Radix or Quicksort seem the > best bet... but I have no idea how to implment them... and nothing from > the STL will help me either (I guess sort in is quicksort.. > but I do not believe it will work due to my strange data stucture. > > Thanks again, > > Sam > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu