Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Once you have practiced the basic algorithm, let\'s quantify stable marriage pro

ID: 3786539 • Letter: O

Question

Once you have practiced the basic algorithm, let's quantify stable marriage problem a little bit. Here we define the following notation: on day j, let P_j(M) be the rank of the woman that man M proposes to (where the first woman on his list has rank 1 and the last has rank n). Also, let R_j(W) be the total number of men that woman W has rejected up through day j - 1 (i.e. not including the proposals on day j). Please answer the following questions using the notation above. (a) Prove or disprove the following claim: sigma_M P_j(M) - sigma_W R_j(W) is independent of j. If it is true, please also give the value of sigma_M P_j(M) - sigma_W R_j(W). The notation, sigma_M and sigma_W, simply means that we are summing over all men and all women. (b) Prove or disprove the following claim: one of the men or women must be matched to someone who is ranked in the top half of their preference list. You may assume that n is even.

Explanation / Answer

Sub Macro1()
'
' Macro1 Macro
'

'
    ActiveWorkbook.Worksheets.Add
    With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
        "ODBC;DSN=MS Access Database;DBQ=C: est.mdb;DefaultDir=C:;DriverId=25;FIL=MS Access;MaxB" _
        ), Array("ufferSize=2048;PageTimeout=5;")), Destination:=Range("$A$1")). _
        QueryTable
        .CommandText = Array( _
        "SELECT Program.`Program Name`, Program.`Program Desc`, Program.`Program Unique`, Program.`Program DB`, Operator.`Operator ID`, Operator.`Operator Unique`, `Device Under Test`.`Device ID`, `Device Unde" _
        , _
        "r Test`.Notes, `Device Under Test`.`Device Under Test Unique`, Data_vD.`Test Unique`, Data_vD.Exclude, Data_vD.`Total Time`, Data_vD.Cycle, Data_vD.`Loop Counter #1`, Data_vD.`Loop Counter #2`, Data_v" _
        , _
        "D.`Loop Counter #3`, Data_vD.Step, Data_vD.`Step time`, Data_vD.Current, Data_vD.Voltage, Data_vD.Power, Data_vD.`Instantaneous Amps`, Data_vD.`Instantaneous Volts`, Data_vD.`Instantaneous Watts`, Dat" _
        , _
        "a_vD.`Amp-Hours`, Data_vD.`Watt-Hours`, Data_vD.`Assignable Variable 1`, Data_vD.`Assignable Variable 2`, Data_vD.Mode, Data_vD.`Data Acquisition Flag`" & Chr(13) & "" & Chr(10) & "FROM `C: est.mdb`.Data_v" _
        , _
        "D Data_vD, `C: est.mdb`.`Device Under Test` `Device Under Test`, `C: est.mdb`.Operator Operator, `C: est.mdb`.Program Program" _
        )
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .PreserveColumnInfo = True
        .ListObject.DisplayName = "Table_Query_from_MS_Access_Database"
        .Refresh BackgroundQuery:=False
    End With
   
    Columns("J:J").Select
    ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort.SortFields.Add Key:=Range( _
        "Table_Query_from_MS_Access_Database[[#All],[Test Unique]]"), SortOn:= _
        xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    ActiveWindow.SmallScroll Down:=-12
    Range("I2").Select
    ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort.SortFields.Add Key:=Range( _
        "Table_Query_from_MS_Access_Database[[#All],[Device Under Test Unique]]"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet4").ListObjects( _
        "Table_Query_from_MS_Access_Database").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With

End Sub

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote