ANSI charactors

  • 28 Replies
  • 3825 Views
*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: ANSI charactors
« Reply #15 on: September 14, 2018, 12:48:22 am »
Are you getting binary sort and binary search mixed up?

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

LOCKSUIT

  • Emerged from nothing
  • Trusty Member
  • *******************
  • Prometheus
  • *
  • 4659
  • First it wiggles, then it is rewarded.
    • Main Project Thread
Re: ANSI charactors
« Reply #16 on: September 14, 2018, 12:55:21 am »
so if my IDs are sorted like this 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...
and not like 4 1 7 2 9 3....
then I can just find "3736" in 1 hit?...

I just want to find "47487" in millions of Ids in a fast amount of time man...

And I don't understand how Binary Search can find the middle ID to start cutting it down by half when it can't just "find" a ID like that so fast. BS can't just "find" the middle element. If it can find that, then it can just find ID "474577" in a sorted array.
Emergent          https://openai.com/blog/

*

LOCKSUIT

  • Emerged from nothing
  • Trusty Member
  • *******************
  • Prometheus
  • *
  • 4659
  • First it wiggles, then it is rewarded.
    • Main Project Thread
Re: ANSI charactors
« Reply #17 on: September 14, 2018, 05:53:30 am »
Can anyone explain how Binary Search finds the middle element in 1 read?

Say you have IDs:
1, 2, 3, 4, 5, 6, 7

Does BS look at half of them just to find it, or only 1 read? If 1 read, how!?
Emergent          https://openai.com/blog/

*

LOCKSUIT

  • Emerged from nothing
  • Trusty Member
  • *******************
  • Prometheus
  • *
  • 4659
  • First it wiggles, then it is rewarded.
    • Main Project Thread
Re: ANSI charactors
« Reply #18 on: September 14, 2018, 06:02:16 am »
Oh sorry, I mean, when BS begins, and wants to compute the middle element just simply so it can start cutting in half the possible IDs, how does it find the middle element in 1 read!?
Emergent          https://openai.com/blog/

*

LOCKSUIT

  • Emerged from nothing
  • Trusty Member
  • *******************
  • Prometheus
  • *
  • 4659
  • First it wiggles, then it is rewarded.
    • Main Project Thread
Re: ANSI charactors
« Reply #19 on: September 14, 2018, 07:02:43 am »
good thing mine will be sorted

see middle area of this vid: https://www.youtube.com/watch?v=JQhciTuD3E8

those 40 or so blocks contains numbers that don't increment by 1 like 1 2 3 4 5 6.....but rather 3 6 13 19 26...

If my IDs are like 1 2 3 4 5 6....i.e. sorted+incremental by 1, then does that mean I can just take 1 read and find ID 464846 instantly and don't need binary search?
Emergent          https://openai.com/blog/

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: ANSI charactors
« Reply #20 on: September 14, 2018, 09:11:40 am »
If you have an array were each element contains a consecutive number with no gaps then you will not need a binary search... But what's the  point? If you already have the index/ address of the required array element and the element just contains the same number, just use the index.

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: ANSI charactors
« Reply #21 on: September 14, 2018, 11:18:00 am »
haha sounds like Locksuit is coming up with his own content addressable memory!

Keep going Locky!   ill give you a merit badge at the finish line.  O0

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1301
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: ANSI charactors
« Reply #22 on: September 15, 2018, 03:42:41 am »
Can anyone explain how Binary Search finds the middle element in 1 read?

Say you have IDs:
1, 2, 3, 4, 5, 6, 7


Yes.  Let's look at some simple PHP...

Code
<?php

$numbers=array(1,2,3,4,5,6,7);

echo var_export($numbers, TRUE);

echo "\n\n";

echo "Middle element:".floor(sizeof($numbers)/2);

echo "\n\n";

?>

array (
  0 => 1,
  1 => 2,
  2 => 3,
  3 => 4,
  4 => 5,
  5 => 6,
  6 => 7,
)

Middle element:3

See? The keys 0 through 6 are automatic.  So, just divide the count by two.
My Very Enormous Monster Just Stopped Using Nine

*

Ultron

  • Trusty Member
  • *******
  • Starship Trooper
  • *
  • 471
  • There are no strings on me.
Re: ANSI charactors
« Reply #23 on: September 15, 2018, 01:36:41 pm »
I suggest you use a real database engine such as MySQL (or depending on your project you may also use a NoSQL horizontally scalable DB). In the table you would have an ID column with an 'auto-increment' setting and omitting this column will not improve performance.

If you really must use arrays and this is only for temporary memory then I suggest using a simple array ( [item item item item] ) and retrieve each element by referencing it's index and this will only work if you need to find "the element at position x", but if you need to find the "position x of element y" than this will be a bad solution (resort to SQL DB).
As a general guideline, referencing an array element by index is faster than retrieving elements by key-value pairs (although this may not be true for all programming languages).
Software and Hardware developer, and everything in between.

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1301
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: ANSI charactors
« Reply #24 on: September 16, 2018, 02:11:42 am »
Here are two ways to do a binary search:

https://www.geeksforgeeks.org/binary-search-php

The way that uses recursion is interesting.
My Very Enormous Monster Just Stopped Using Nine

*

LOCKSUIT

  • Emerged from nothing
  • Trusty Member
  • *******************
  • Prometheus
  • *
  • 4659
  • First it wiggles, then it is rewarded.
    • Main Project Thread
Re: ANSI charactors
« Reply #25 on: September 16, 2018, 07:20:45 am »
If i want to store in my python script a whole lot a crazy characters lik ! , ' " : [ { + =......won't python think I am talking python?

Like look dude...:

array = 3, 4, 2, 5, 7, %, ',

Also another request, I want that array to look like this because it saves on space: 3,4,2,5,7,%,', else memory WILL grow.

How how how!!?? Do I use a string to do binary search in (or just search as korr agreed if it is sorted and ID incremental ex. 1 2 3)?

I will basically have jumble like this with spaces or commas as the definer of the start of a new ID or "node" if you will:
array/string = H,J.k&,%5,"D L,P H,#$ k.^# ...........<- *notice the spaces* (can be commas)
Emergent          https://openai.com/blog/

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1301
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: ANSI charactors
« Reply #26 on: September 16, 2018, 12:11:00 pm »
"won't python think I am talking python?", Lock Suit asked.  In friendly response (not sarcastically)... "So what if it does?
Basically suggesting a short Python script be written and executed to test and see what happens.

Python console:

>>>
[Locksuit for Locksuit in "HJk&%5DLP#$k.^#"]

['H', 'J', 'k', '&', '%', '5', 'D', 'L', 'P', '#', '$', 'k', '.', '^', '#']

My Very Enormous Monster Just Stopped Using Nine

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: ANSI charactors
« Reply #27 on: September 16, 2018, 12:21:09 pm »
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers

Make the time and effort to learn programming lock, you will really enjoy it.

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

Ultron

  • Trusty Member
  • *******
  • Starship Trooper
  • *
  • 471
  • There are no strings on me.
Re: ANSI charactors
« Reply #28 on: September 16, 2018, 03:51:57 pm »
I very much agree with Korrelan. In fact, I don't see a way how anyone would design artificial intelligence if one does not understand the basic principles of programming - unless this person believes a completely new computing model should be designed with completely new programming techniques (which I would agree with) but then one would have to be an adept mathematician, at which point becoming a programmer would represent only a formality.
Software and Hardware developer, and everything in between.

 


OpenAI Speech-to-Speech Reasoning Demo
by ivan.moony (AI News )
Today at 01:31:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

309 Guests, 2 Users
Users active in past 15 minutes:
ivan.moony, 8pla.net
[Trusty Member]

Most Online Today: 335. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles