More Tests of two Selection Sort Implementations

In our last blog we introduced two algorithms for implementing the selection sort which differed by the number of swap operations involved. The two required the same number of comparisons n * (n – 1) / 2 = 45 for n = 10, where n is the length of the array to be sorted and different number of swaps. We notice about a two-fold speed up in sorting using the minimal number of swaps version. Also make sure the number of swaps is implemented by a 64-bit integer since 100,000 * 99,999 = 9,999,899,999 which overflows a 32-bit integer. I learned about overflow while trying to sort large arrays of integers.

Who Knew? Better Code for Selection Sort

I have been using inferior code for the Selection Sort since 1979. Last night I found the more efficient pseudo code:

Data Structure and Algorithms Selection Sort – Tutorialspoint

Here is my old code for the Selection Sort in C#:

Old Code for the Algorithm

And my new code from the more efficient pseudo code found online:

New and Better Code
Common Swap Function (Procedure)

Both implementations require n * (n – 1) / 2 comparisons which for an array of length 15 is 15 * 14 /2 = 15 * 7 = 105. The second implementation requires typically fewer calls to the swap function.

Selection Sort Test 15-Element Random Array
Selection Sort Test 15-Element Reverse Ordered Array
Selection Sort Test 15-Element Sorted Array

The first number after the unsorted array is the number of comparisons which is always 105 in our 15-element test cases. The second number is the tally of the swap function calls.

An Anamnesis by James Pate Williams, Jr.

My Pathways counselor seems to believe I would be a good person to enter the Positive Options rehabilitation program at the Troup County Mental Health Clinic. The reason I am not attending the adult daycare and supportive living training  program Pathways, Positive Options, is that I do not see that I would derive any benefit from the program. The program seems to be geared towards the recently or current homeless population with mental aberrations. When I unilaterally stop taking my anti-psychotic medication, I might be a good candidate for the Pathways program. I am pretty much asymptomatic when I take my medication on my own schedule or more likely as prescribed.

I have been under the care of the Troup County Pathways Mental Health Clinic since around 1988 or 1989. I have been under psychiatric care since late 1972 or early 1973. I have sojourned in a good number of hospitals both private and state of Georgia operated:

  1. Peachtree-Parkwood Hospital in Atlanta, private a few months of care in the period 1973 to 1975 1999 Cliff Valley Way
  2. Central State Regional Hospital in Milledgeville, state, a couple of weeks in 1975
  3. West Central Georgia Regional Hospital in Columbus, state, about a month in 1975
  4. Renewal House in Atlanta, state, drug rehab, a few months in 1975 until sometime in early 1976
  5. Bradley Center Hospital in Columbus, private, a few months in late 1986 until early in 1987
  6. Troup County Pathways Mental Health Clinic beginning in probably 1988 or early 1989
  7. New Ventures, state, vocational rehabilitation late 1988 until almost Fall Quarter 1990
  8. Pathways Second Season in LaGrange, two weeks in March 2010
  9. Northwest Regional Hospital in Rome, state, a couple of months in the spring of 2010
  10. Northwest Regional Hospital in Rome, state, two or three weeks in June – July 2010
  11. Troup County Jail from May 8, 2019 until June 12, 2019 and from October 17, 2019 until November 26, 2019
  12. I was shuttled from Troup Count Jail to Pathways Second Season on June 12, 2019. I stayed at that locale from June 12, 2019 until October 17, 2019, a record setting 127 days

Now for my academic records:

I barely graduated from LaGrange High School. I was caught with a marijuana cigarette (joint) in my pocket by the assistant principal Mr. Sturdivant, one day in late Winter 1971. I had to perform a mea culpa before the Board of Education to return to school in time to graduate. I think that my dad and the Chairman of the Board, Charles Hudson, were influential in my graduation. I was a teenage abuser of alcohol and drugs.

I entered LaGrange College in Fall Quarter 1971 and I performed increasingly abysmal in my studies. At the end of Spring Quarter my GPA was a terrible 0.75 out of 4.00. I did not return to the college until Fall Quarter 1976. My drug abuse helped make me a poor student.

I graduated from LaGrange College on June 2, 1979. I earned A Bachelor of Arts in Chemistry with a low 3.00+ GPA. I applied and was accepted to be a teaching assistant in Chemistry at the Georgia Institute of Technology in Fall Quarter 1980. I left Georgia Tech after the Summer Quarter of 1983 sans a degree and with a poor GPA of 2.79 out of 4.00.

I returned to LaGrange College in the Spring Quarter of 1990. I graduated on June 2, 1994 with a Bachelor of Science in Computer Science. I had a 4.00 out of 4.00 in all my computer classes from 1990 until 1994.

I matriculated at Auburn University as a Computer Science graduate student in Fall Quarter 1998. I believe the Professor Alfred J. Menezes was instrumental in getting me accepted at Auburn University. Professor Menezes left Auburn University in the 1990s and went to his old University, the University of Waterloo in Ontario, Canada. I graduated with a Master of Software Engineering in Summer Quarter 2000. I had a GPA of 3.880 out of 4.000. I went onto attain a Doctor of Philosophy in Computer Science in the Fall Semester 2005 with a 3.871 GPA.

My work for dollars record is very spotty and chock full of gaps. However, in my defense, I have done a lot of pro bono work and open-source public domain software development. I designed, implemented, and maintained a cryptography, constraint satisfaction problem, and number theory website that was widely viewed in the period 1997 until 2010 or 2011. I did a lot of sophisticated and some mundane volunteer work for the First Methodist Church of LaGrange, Georgia from 2008 to about 2011. Also, at the advanced age of 65 and 66, I had three live interviews for civilian jobs with the United States Department of Defense in 2018 and early 2019. During the period 2011 until 2018 I had two or three phone interviews and did tests for the Department of Defense.

Another bad idea suggested by my Pathways counselor was for me to volunteer to help at the local food pantry handing out grocery items to the disenfranchised in the community. If I am to volunteer again, I want my unique cognitive skills engaged. I could tutor GED or college students in chemistry, computer science, mathematics, or general science. I could help individuals learn computer programming as a hobby or vocational skill and/or teach Digital Audio Workstation operation and arranging and recording music.  Last but not least I could demonstrate the use of a MIDI keyboard and accompanying synthesizer.

Solving Four Elliptic Partial Differential Equations Using the Finite Element Method by James Pate Williams, Jr.

The equations I solve in this blog entry are from a thesis that uses artificial neural networks to solve partial differential equations:

https://dukespace.lib.duke.edu/dspace/handle/10161/8197

Here are the equations snipped from the thesis:

Alpha is defined as 0.5 * n. In our case n = 1, 2, 3, 4.

The solutions for the four cases above are graphed using Microsoft Mathematics:

Elliptic Partial Differential Equation for n = 1
Elliptic Partial Differential Equation for n = 2
Elliptic Partial Differential Equation for n = 3
Elliptic Partial Differential Equation for n = 4

The Microsoft Mathematics Application Window is illustrated below:

Microsoft Mathematics Application
Finite Element Method Elliptic PDF Solver Main Form 1
Finite Element Method Elliptic PDF Solver Main Form 2
Finite Element Method Elliptic PDF Solver Main Form 3
Finite Element Method Elliptic PDF Solver Equation Class 1
Finite Element Method Elliptic PDF Solver Equation Class 2

Private and Public Imminent Demand by James Pate Williams, Jr., BA, BS, MSwE, PhD

I preface these remarks with the fact I believe in many public imminent demands if there is a Fair Market Value (FMV) for the property, and the demand is good for the community, especially the taxpayers. There are cases that I do not agree with the private sector imminent domain that seems to side with small businessperson regarding who may or may not be served by the small business.

I have been denied service by the following LaGrange, Georgia businesses:

  1. International House of Pancakes
  2. Lafayette Arms Motel
  3. Gus’ Grill
  4. Walmart Super-center
  5. Krystal
  6. Planet Fitness
  7. Town Fitness
  8. Dixie Donuts

The reason for these expulsions revolves around my mental illness. Sometimes in the past I have gone off my medication and thus tended to spiral into an abnormal manic and obnoxious state. The local, state, and federal governments have not given me equal protection under the applicable anti-discrimination legislation. The governments’ way of dealing with me is locking me away in isolation with forced medication. The Georgia Gulag Archipelago (my term for the now mainly forensic state hospitals) are very terrifying and dangerous environments. The local county jails in Georgia seem to be largely discriminatory against the mentally ill. I have recently been locked away first in the Troup County Jail for 30 days then Pathways defunct Second Season for 127 days and then back to jail for 40 days all in the calendar year of 2019. I was released to pay a hefty fine and serve a long probationary period.

What hurts even more is the fact that the church I faithfully volunteered at for over two years can find no more voluntary work for me to perform. I have become a Persona Non Grata at the First United Methodist Church of LaGrange, Georgia.

Anatomy of an Alleged Con Artist Performance by James Pate Williams, Jr., BA, BS, MSwE, PhD

As a preface I was on the dating website ZOOSK for a few months recently. An individual whose alleged name is Susie W. Alexander got in touch with me via my email address.  My first contact is dated October 15, 2020. She sent three pictures that she alleged were of her and perhaps her daughter. She told me a good bit about  herself before things started looking like a con artist performance on November 2 – 4, 2020. I think the pictures she sent to me were probably stock online catalog pictures or were staged to show a good looking and affluent individual and perhaps her daughter.

In her emails she alleged that her mother was Danish, and her dad was from Saxony, a state in Germany. She stated that she adored her father, and he was a somewhat famous civil engineer. She relayed the information that her father worked on the bridge-tunnel system over and under the Baltic Sea from Copenhagen, Denmark to a town in Sweden. She also said that she was a civil engineer. She made the remark that she grew-up in Germany then went to the United Kingdom for further schooling. She said that while working in Australia she met her only child’s father. The father, her husband, supposedly died of leukemia around five years ago.

Supposedly in early November Susie made a business junket from New York City to Cape Town, South Africa. On the flight over to South Africa and two-thirds of her luggage, two bags, turned up missing. That means four bags arrived intact and contained a cash stash to pay her construction day workers. The two missing bags contained expensive electronics including a smartphone and laptop. She emailed me asking that I pay for replacement electronics until her next payday. At that point I knew that perhaps Susie was a con artist and I had been targeted to be played like an out-of-tune violin.

Since the Susie episode I have been online accosted by a Lisa from allegedly Bristol, Tennessee (or Virginia). This Lisa character wants me to join a website with pornographic images of probably underage and perhaps sexually trafficked females. I have stated negatively twice to Lisa about logging onto the website. I now believe that Lisa is perhaps a pornographic bot that a hacker or law enforcement hacker created to legally, but unconstitutionally, entrap me.

The AKS Prime Number Test Versus the Lucas-Lehmer Test on Mersenne Numbers Only by James Pate Williams, Jr., BA, BS, MSwE, PhD

First the Lucas-Lehmer results for exponents between 3 and 2000:

Now the general Agrawal-Kayal-Saxena (AKS) primal number test on three of the preceding Mersenne primes with exponents 127, 521, 607, and 1279:

Notice that special purpose Lucas-Lehmer Test (LLT) is much faster than the general prime number test (AKS Test).